Skip to content

Commit e7f9486

Browse files
committed
Compare empty express benchmark to opentelemetry
1 parent 7ae1632 commit e7f9486

File tree

3 files changed

+2036
-0
lines changed

3 files changed

+2036
-0
lines changed

benchmarks/express/benchmark.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,38 @@ async function run() {
5757
// Stop the server
5858
withoutFirewallProc.kill();
5959

60+
const withOpenTelemetryProc = spawn("node", ["app.js"], {
61+
env: {
62+
...process.env,
63+
PORT: 5003,
64+
NODE_OPTIONS:
65+
"--require @opentelemetry/auto-instrumentations-node/register",
66+
OTEL_TRACES_EXPORTER: "none",
67+
OTEL_METRICS_EXPORTER: "none",
68+
OTEL_LOGS_EXPORTER: "none",
69+
},
70+
stdio: "inherit",
71+
});
72+
73+
// Wait 2 seconds for the server to start and settle
74+
await setTimeout(2000);
75+
76+
const resultWithOpenTelemetry = await exec(
77+
generateWrkCommandForUrl("http://localhost:5003/empty")
78+
);
79+
80+
// Stop the server
81+
withOpenTelemetryProc.unref();
82+
withOpenTelemetryProc.kill();
83+
6084
const withFirewall = parseFloat(resultWithFirewall.stdout.trim());
6185
const withoutFirewall = parseFloat(resultWithoutFirewall.stdout.trim());
86+
const withOpenTelemetry = parseFloat(resultWithOpenTelemetry.stdout.trim());
6287

6388
console.log("--- Results ---");
6489
console.log(`Without Zen: ${withoutFirewall} Requests/sec`);
6590
console.log(`With Zen: ${withFirewall} Requests/sec`);
91+
console.log(`With OpenTelemetry: ${withOpenTelemetry} Requests/sec`);
6692

6793
const increase = ((withoutFirewall - withFirewall) / withoutFirewall) * 100;
6894
console.log(`Decrease with Zen for an empty route: ${increase.toFixed(2)}%`);

0 commit comments

Comments
 (0)