From dc34faecf62a83c88cd4e160cac74a8b46b26fcf Mon Sep 17 00:00:00 2001 From: James Yab Date: Mon, 29 Dec 2025 19:39:46 -0500 Subject: [PATCH] Update benchmark results using -O2 release flags --- README.md | 41 ++++++++++++++++---------------- benchmarks/benchmark-results.txt | 34 +++++++++++++------------- 2 files changed, 38 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 9e4f37e..6a49c5d 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ A modern C++ HTTP server implementation with routing, testing, and CI-driven qua ## Benchmark Results -This project was benchmarked using k6 to evaluate HTTP request throughput, latency, and stability under sustained load. It sustained ~27,000 RPS locally with p99 < 30 ms (using a Ryzen 5 5600G). Keep in mind, that this was a local benchmark that does not reflect real networks and it does not utilize TLS, auth, databases, or disk usage. Check out `benchmarks/benchmark-results.txt` to see the benchmark results captured with k6. +This project was benchmarked using k6 to evaluate HTTP request throughput, latency, and stability under sustained load. It sustained ~29,600 RPS locally with p99 < 7 ms (using a Ryzen 5 5600G). Keep in mind, that this was a local benchmark that does not reflect real networks and it does not utilize TLS, auth, databases, or disk usage. Check out `benchmarks/benchmark-results.txt` to see the benchmark results captured with k6. ### Test Setup @@ -73,25 +73,26 @@ As such, these results demonstrate that the server can reliably handle at least I made sure that the node express server implemented multi-threading to provide a more fair comparison with the cpp_http_server. Check out `benchmarks/node_server` to see the node express server implementation. -The cpp_http_server is ~1.562x faster in throughput or about 56.2% higher request rate. - -Calculation: 27,366.734925 RPS / 17,524.167725 RPS = ~1.5612 - -| Metric | **C++ Server** | **Node + Express** | -|--------------------|-------------------|--------------------| -| Target rate | 30,000.00 RPS | 30,000.00 RPS | -| Actual RPS | 27,366.734925 RPS | 17,524.167725 RPS | -| Total requests | 280,791 | 176,924 | -| Dropped iterations | 19,214 | 123,126 | -| Average latency | 5.47 ms | 46.88 ms | -| Median latency | 3.44 ms | 34.1 ms | -| p90 latency | 13.55 ms | 103.24 ms | -| p95 latency | 17.34 ms | 132.88 ms | -| p99 latency | 26.06 ms | 192.68 ms | -| Max latency | 219.18 ms | 445.75 ms | -| Error rate | 0.00% | 0.00% | -| Peak VUs | 945 | 1,693 | -| Iterations/sec | 27,366.734925 | 17,524.167725 | +The cpp_http_server is ~1.693x faster in throughput or about 69.3% higher request rate. Nice! + +Calculation: 29,675.882135 RPS / 17,524.167725 RPS = ~1.693 + +| Metric | **C++ Server (updated)** | **Node + Express** | +| ------------------ | ------------------------ | ------------------ | +| Target RPS | 30,000.00 | 30,000.00 | +| Actual RPS | 29,675.882135 | 17,524.167725 | +| Total requests | 296,824 | 176,924 | +| Dropped iterations | 3,180 | 123,126 | +| Avg latency | 1.12 ms | 46.88 ms | +| Median latency | 404.76 µs | 34.1 ms | +| p90 latency | 3.24 ms | 103.24 ms | +| p95 latency | 4.3 ms | 132.88 ms | +| p99 latency | 6.58 ms | 192.68 ms | +| Max latency | 22.7 ms | 445.75 ms | +| Error rate | 0.00% | 0.00% | +| Peak VUs | 332 | 1,693 | +| Iterations/sec | 29,675.882135 | 17,524.167725 | + --- diff --git a/benchmarks/benchmark-results.txt b/benchmarks/benchmark-results.txt index 20ec67e..ec39193 100644 --- a/benchmarks/benchmark-results.txt +++ b/benchmarks/benchmark-results.txt @@ -17,7 +17,7 @@ █ THRESHOLDS http_req_duration - ✓ 'p(99)<1000' p(99)=26.06ms + ✓ 'p(99)<1000' p(99)=6.58ms http_req_failed ✓ 'rate<0.01' rate=0.00% @@ -25,31 +25,31 @@ █ TOTAL RESULTS - checks_total.......: 280791 27366.734925/s - checks_succeeded...: 100.00% 280791 out of 280791 - checks_failed......: 0.00% 0 out of 280791 + checks_total.......: 296824 29675.882135/s + checks_succeeded...: 100.00% 296824 out of 296824 + checks_failed......: 0.00% 0 out of 296824 ✓ response code was 200 HTTP - http_req_duration..............: avg=5.47ms min=60.06µs med=3.44ms max=219.18ms p(90)=13.55ms p(95)=17.34ms - { expected_response:true }...: avg=5.47ms min=60.06µs med=3.44ms max=219.18ms p(90)=13.55ms p(95)=17.34ms - http_req_failed................: 0.00% 0 out of 280791 - http_reqs......................: 280791 27366.734925/s + http_req_duration..............: avg=1.12ms min=49.86µs med=404.76µs max=22.7ms p(90)=3.24ms p(95)=4.3ms + { expected_response:true }...: avg=1.12ms min=49.86µs med=404.76µs max=22.7ms p(90)=3.24ms p(95)=4.3ms + http_req_failed................: 0.00% 0 out of 296824 + http_reqs......................: 296824 29675.882135/s EXECUTION - dropped_iterations.............: 19214 1872.654198/s - iteration_duration.............: avg=10.01ms min=188.24µs med=6.19ms max=1.08s p(90)=20.55ms p(95)=26.14ms - iterations.....................: 280791 27366.734925/s - vus............................: 506 min=77 max=506 - vus_max........................: 945 min=223 max=945 + dropped_iterations.............: 3180 317.930171/s + iteration_duration.............: avg=1.9ms min=158.01µs med=768.07µs max=27.29ms p(90)=5.06ms p(95)=6.74ms + iterations.....................: 296824 29675.882135/s + vus............................: 64 min=8 max=138 + vus_max........................: 332 min=155 max=332 NETWORK - data_received..................: 24 MB 2.3 MB/s - data_sent......................: 30 MB 2.9 MB/s + data_received..................: 25 MB 2.5 MB/s + data_sent......................: 32 MB 3.2 MB/s -running (10.3s), 00000/00945 VUs, 280791 complete and 0 interrupted iterations -constant_request_rate ✓ [======================================] 00000/00945 VUs 10s 30000.00 iters/s +running (10.0s), 00000/00332 VUs, 296824 complete and 0 interrupted iterations +constant_request_rate ✓ [ 100% ] 00000/00332 VUs 10s 30000.00 iters/s