JavaScript runtime benchmark: Node.js, Deno, Bun

The same API on three JavaScript runtimes, each as a single process and with one worker per CPU, driven by the same k6 load test as the Go framework and Laravel PHP runtime benchmarks, on the same machine.

Runtimes

Whole run, all five scenarios combined. Latency counts successful responses only.

Takeaways

What the numbers say, and what they don't.

Throughput (requests per second)

Latency per scenario (ms, log scale)

Per scenario

Average latency in ms, with p95 below. Green marks the best JS runtime in each row. The grey columns are the fastest Go framework and the fastest PHP runtime by throughput.

Overall, with Go and PHP for reference

Go and PHP ran on the same VM, with the same k6 script and database schema.

How it was run

Everything runs in Docker Compose on one VM. Runtimes are benchmarked one at a time.

k6 scenarios

ScenarioEndpointVUsDuration
Health checkGET /api/health500030s
List 20 postsGET /api/posts1000→500→1000→060s
Single postGET /api/posts/{id}300030s
Create postPOST /api/posts200030s
Heavy computeGET /api/heavy200030s

Test machine

HostAzure Standard_D4as_v6
CPUAMD EPYC 9V74, 4 vCPU
RAM15.6 GiB, no swap
OSUbuntu 24.04.5, kernel 7.0
RuntimesNode.js 26.13.0, Deno 2.9.8, Bun 1.4.4
DatabasePostgreSQL 16, postgres.js 4.1.0, 50 connections per app
Loadk6 v2.3.0 on the same machine

Fairness notes

  • Routing, DB access, validation and the CPU workload live in one shared module that runs unchanged on all three runtimes. Each runtime only provides its own HTTP server: node:http, deno serve, Bun.serve.
  • All three use the same Postgres driver (postgres.js), installed once and copied into every image.
  • Multi-worker variants run one worker per CPU (4) and split the 50 database connections between them, so every app has the same total.
  • No request logging. Every container gets a 65535 open-file limit. The posts table is reset to the same 100 seeded rows before each run.
  • k6, Postgres and the server share the same 4 vCPUs, so absolute numbers are lower than on a dedicated setup. The comparison is still like for like.