Skip to main content

Concurrency Test

This benchmark evaluates how Solvix performs under high levels of concurrent requests.

Why Concurrency Matters

In real-world systems:

  • Multiple users hit APIs simultaneously
  • Services process parallel workloads
  • Systems must scale efficiently

A good HTTP client must handle concurrency without:

  • Blocking execution
  • Creating bottlenecks
  • Causing race conditions

Test Objective

To measure:

  • Throughput under concurrent load
  • Latency under parallel execution
  • Stability of request handling
  • Efficiency of internal queue system

Test Setup

  • Runtime: Node.js
  • Tool: Tinybench
  • Duration: 2 seconds
  • Requests: Parallel execution
  • Transport: Lightweight / mock

Test Code

import { Bench } from "tinybench";
import { createClient } from "solvix";

const client = createClient({
baseURL: "https://example.com",
});

const bench = new Bench({ time: 2000 });

bench.add("solvix concurrency", async () => {
await Promise.all(Array.from({ length: 50 }).map(() => client.get("/test")));
});

await bench.run();

console.log(bench.tasks.map((t) => t.result));

Results

Latency Mean: ~0.0010 ms
Throughput Mean: ~989,636 ops/sec
Samples: ~1.9M
RME: ~0.19%

Analysis

Observations

  • Extremely low latency under parallel load
  • High throughput (~1M ops/sec)
  • Very low RME (high confidence)
  • Stable execution without crashes

Internal Mechanisms That Enable This

Solvix handles concurrency using:

  • Non-blocking async execution
  • Efficient promise handling
  • Optimized request pipeline
  • Lightweight abstraction over transport

Optional: With Rate Limiting Enabled

const client = createClient({
rateLimit: {
capacity: 20,
refillRate: 10,
interval: 1000,
},
});

Result Behavior

  • Throughput becomes controlled
  • Latency increases slightly
  • System becomes safer under load

Optional: With Priority Queue

client.get("/critical", { priority: 1 });
client.get("/normal", { priority: 5 });

Ensures:

  • Critical requests are executed first
  • Better traffic management

Real-World Impact

This makes Solvix suitable for:

  • High traffic applications
  • Microservices communication
  • API gateways
  • Real-time systems

Best Practices

  • Use concurrency wisely (avoid overload)
  • Combine with rate limiting
  • Prioritize critical requests
  • Monitor latency in production

Conclusion

Solvix demonstrates:

  • High throughput under heavy concurrency
  • Stable execution
  • Efficient request handling

Making it production-ready for large-scale systems.