Skip to content

Commit 60ee932

Browse files
authored
Merge pull request #45 from yabjames/disable-tls-node-server
Disable TLS in the node server comparison
2 parents 78b8fe6 + 5aaec05 commit 60ee932

5 files changed

Lines changed: 54 additions & 44 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
build/
2+
node_modules/
23
.venv/
34
a.out
45
CMakeUserPresets.json

README.md

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -74,25 +74,26 @@ As such, these results demonstrate that the server can reliably handle at least
7474
I made sure that the node express server implemented multi-threading to provide a more fair comparison with the cpp_http_server.
7575
Check out `benchmarks/node_server` to see the node express server implementation.
7676

77-
The cpp_http_server is ~1.693x faster in throughput or about 69.3% higher request rate. Nice!
78-
79-
Calculation: 29,675.882135 RPS / 17,524.167725 RPS = ~1.693
80-
81-
| Metric | **C++ Server (updated)** | **Node + Express** |
82-
| ------------------ | ------------------------ | ------------------ |
83-
| Target RPS | 30,000.00 | 30,000.00 |
84-
| Actual RPS | 29,675.882135 | 17,524.167725 |
85-
| Total requests | 296,824 | 176,924 |
86-
| Dropped iterations | 3,180 | 123,126 |
87-
| Avg latency | 1.12 ms | 46.88 ms |
88-
| Median latency | 404.76 µs | 34.1 ms |
89-
| p90 latency | 3.24 ms | 103.24 ms |
90-
| p95 latency | 4.3 ms | 132.88 ms |
91-
| p99 latency | 6.58 ms | 192.68 ms |
92-
| Max latency | 22.7 ms | 445.75 ms |
93-
| Error rate | 0.00% | 0.00% |
94-
| Peak VUs | 332 | 1,693 |
95-
| Iterations/sec | 29,675.882135 | 17,524.167725 |
77+
The cpp_http_server is ~1.45x faster in throughput or about 44.9% higher request rate. Nice!
78+
79+
Calculation: 29,675.882135 RPS / 20,468.045127 RPS = ~1.449
80+
81+
| Metric | **C++ Server** | **Node + Express** |
82+
|--------------------|----------------|--------------------|
83+
| Target RPS | 30,000.00 | 30,000.00 |
84+
| Actual RPS | 29,675.882135 | 20,468.045127 |
85+
| Total requests | 296,824 | 205,983 |
86+
| Dropped iterations | 3,180 | 123,126 |
87+
| Avg latency | 1.12 ms | 38.99 ms |
88+
| Median latency | 404.76 µs | 30.25 ms |
89+
| p90 latency | 3.24 ms | 81.37 ms |
90+
| p95 latency | 4.3 ms | 102.58 ms |
91+
| p99 latency | 6.58 ms | 149.76 ms |
92+
| Max latency | 22.7 ms | 318.66 ms |
93+
| Error rate | 0.00% | 0.00% |
94+
| Peak VUs | 332 | 1,547 |
95+
96+
9697

9798

9899
---
Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

2-
/\ Grafana /‾‾/
3-
/\ / \ |\ __ / /
4-
/ \/ \ | |/ / / ‾‾\
2+
/\ Grafana /‾‾/
3+
/\ / \ |\ __ / /
4+
/ \/ \ | |/ / / ‾‾\
55
/ \ | ( | (‾) |
6-
/ __________ \ |_|\_\ \_____/
6+
/ __________ \ |_|\_\ \_____/
77

88
execution: local
99
script: k6.js
@@ -14,42 +14,42 @@
1414

1515

1616

17-
█ THRESHOLDS
17+
█ THRESHOLDS
1818

1919
http_req_duration
20-
✓ 'p(99)<1000' p(99)=192.68ms
20+
✓ 'p(99)<1000' p(99)=149.76ms
2121

2222
http_req_failed
2323
✓ 'rate<0.01' rate=0.00%
2424

2525

26-
█ TOTAL RESULTS
26+
█ TOTAL RESULTS
2727

28-
checks_total.......: 176924 17524.167725/s
29-
checks_succeeded...: 100.00% 176924 out of 176924
30-
checks_failed......: 0.00% 0 out of 176924
28+
checks_total.......: 205983 20468.045127/s
29+
checks_succeeded...: 100.00% 205983 out of 205983
30+
checks_failed......: 0.00% 0 out of 205983
3131

3232
✓ response code was 200
3333

3434
HTTP
35-
http_req_duration..............: avg=46.88ms min=180.69µs med=34.1ms max=445.75ms p(90)=103.24ms p(95)=132.88ms
36-
{ expected_response:true }...: avg=46.88ms min=180.69µs med=34.1ms max=445.75ms p(90)=103.24ms p(95)=132.88ms
37-
http_req_failed................: 0.00% 0 out of 176924
38-
http_reqs......................: 176924 17524.167725/s
35+
http_req_duration..............: avg=38.99ms min=221µs med=30.25ms max=318.66ms p(90)=81.37ms p(95)=102.58ms
36+
{ expected_response:true }...: avg=38.99ms min=221µs med=30.25ms max=318.66ms p(90)=81.37ms p(95)=102.58ms
37+
http_req_failed................: 0.00% 0 out of 205983
38+
http_reqs......................: 205983 20468.045127/s
3939

4040
EXECUTION
41-
dropped_iterations.............: 123126 12195.522797/s
42-
iteration_duration.............: avg=50.97ms min=253.76µs med=37.01ms max=468.22ms p(90)=112.5ms p(95)=142.84ms
43-
iterations.....................: 176924 17524.167725/s
44-
vus............................: 1679 min=249 max=1679
45-
vus_max........................: 1693 min=474 max=1693
41+
dropped_iterations.............: 94056 9346.122993/s
42+
iteration_duration.............: avg=42.23ms min=299.06µs med=32.98ms max=338.26ms p(90)=87.68ms p(95)=109.67ms
43+
iterations.....................: 205983 20468.045127/s
44+
vus............................: 1494 min=446 max=1494
45+
vus_max........................: 1547 min=453 max=1547
4646

4747
NETWORK
48-
data_received..................: 46 MB 4.6 MB/s
49-
data_sent......................: 19 MB 1.9 MB/s
48+
data_received..................: 54 MB 5.3 MB/s
49+
data_sent......................: 22 MB 2.2 MB/s
5050

5151

5252

5353

54-
running (10.1s), 00000/01695 VUs, 176924 complete and 0 interrupted iterations
55-
constant_request_rate ✓ [ 100% ] 00000/01695 VUs 10s 30000.00 iters/s
54+
running (10.1s), 00000/01549 VUs, 205983 complete and 0 interrupted iterations
55+
constant_request_rate ✓ [ 100% ] 00000/01549 VUs 10s 30000.00 iters/s

benchmarks/node_server/server.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import cluster from "node:cluster";
22
import os from "node:os";
33
import express from "express";
4+
import http from "http";
45

56
if (cluster.isPrimary) {
67
const numCPUs = os.cpus().length;
@@ -17,7 +18,8 @@ if (cluster.isPrimary) {
1718
});
1819
});
1920

20-
app.listen(3490, () => {
21+
// disable TLS
22+
http.createServer(app).listen(3490, () => {
2123
console.log("Express server listening on http://localhost:3490");
2224
});
2325
}

k6.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,14 @@ export const options = {
1818
},
1919
};
2020

21+
function rand(min, max) {
22+
min = Math.ceil(min);
23+
max = Math.floor(max);
24+
return Math.floor(Math.random() * (max - min + 1)) + min;
25+
}
26+
2127
export default function () {
22-
const res = http.post("http://localhost:3490/test2/123/foo/432");
28+
const res = http.post(`http://localhost:3490/test2/${rand(0,999)}/foo/123`);
2329
check(res, {
2430
"response code was 200": (res) => res.status == 200,
2531
});

0 commit comments

Comments
 (0)