Spent getting a connection94 %of server p50 (281.6 ms)
CPU (1 vCPU)99 %Node 48 · Postgres 44
Memory used493 MBof 961 MB · Node 127 · PG 114
Summary
Capacity: 1400 VUs at 645 req/s (38,707 req/min), steady p50 320 ms / p95 676 ms / p99 802 ms, 0 % errors. The first failing level is 1500 VUs: 688 req/s, p99 1168 ms (limit 1000), still 0 % errors. All levels from 1000 to 1400 VUs passed. Likely a small gain over v04, not proven: Postgres's CPU share dropped consistently, but the throughput difference is within the host-speed noise.
Prepared statements cut Postgres's share of the CPU. At saturation the split is Node ≈ 48 % / Postgres ≈ 43.5 % (v02/v04: ≈ 42 % / ≈ 50 %); at 1000 VUs Postgres uses 37 % vs. 42 % in v02. Skipping parse and plan on every query is visible as a lower Postgres share at every level, which does not depend on the host speed.
Throughput at saturation is the best so far, but by less than the noise. v05 served 633 / 645 / 688 req/s at 1300 / 1400 / 1500 VUs (v04: 542 / 661 / 614; v02: 651 / 518 / 547). The average over those three levels is 655 req/s vs. 606 (v04) and 572 (v02). Single runs swing ±60 req/s, so this is a hint of a ≈ 5–10 % gain.
The first 1500-VU run passed at 802 req/s and is not counted. It reached p50 15 ms / p95 124 ms / p99 165 ms at only 92 % CPU, i.e. 1.15 ms CPU per request vs. 1.45–1.67 ms in every other run of every tag. The CPU cost per request was lower from the first seconds of the ramp (1.72 vs. ≈ 2.1 ms at the same 340 req/s), so the droplet's shared vCPU ran ≈ 30 % faster during that run (steal 0.07 %, so steal does not show it). The user asked for a rerun: 688 req/s, FAIL on p99. Only the rerun is in vus-1500/.
This explains much of the run-to-run noise in all tags. A fixed CPU workload timed on the idle droplet varies ±20 % within seconds (67–98 ms). From the next tag on, every run records a host-speed probe before and after k6 (cpu_probe_before_ms / cpu_probe_after_ms) and the CPU cost per request (cpu_ms_per_req_steady).
Memory is not a constraint. Peak 497 MB used, Node ≤ 130 MB, Postgres ≤ 114 MB, no swap.
The runs are clean. CPU never dropped below 70 % during any saturated hold phase, steal ≤ 0.9 %, the load generator averaged 19–22 % CPU, and app_log_tail.txt has no errors.
Next: a profiling run of this configuration (below) shows Postgres's Memoize step costs ≈ 10 % of Postgres CPU in the feed queries for no benefit. v06: enable_memoize = off. After that: Fastify (Express + router are ≈ 24 % of Node's JS time), then the 1 s feed cache.
Levels tested
Latency is the client-observed steady phase (60 s hold). Red values miss the pass rule. Server and conn come from the app's Server-Timing header, p50 / p95 in ms.
VUs
Result
req/s
p50
p95
p99
Errors %
Server
Conn
CPU % (Node / PG)
Used MB
Load gen CPU %
1,000
Pass
534.0
13
105
187
0.00
7 / 74
0 / 56
89 (44 / 37)
477
61
1,300
Pass
633.1
200
445
813
0.00
177 / 422
161 / 405
99 (48 / 44)
483
65
1,400
Pass
645.1
320
676
801
0.00
298 / 653
282 / 635
99 (48 / 44)
493
63
1,500
Failp99 1168>=1000ms
687.6
318
731
1,168
0.00
297 / 711
283 / 693
100 (49 / 44)
497
50
Across levels
Client latency vs. users steady phase, ms; dashed = limitsWhere server time goes p50 per request, ms
During the run
From k6's 2-second snapshots and the 1-second server samples, aligned on the k6 start. The shaded band is the 60 s ramp; the hold phase follows.
Load active users, req/s, failed req/sLatency over time 2 s windows, msTarget droplet CPU % of 1 vCPU, memory used MBp95 by endpoint client vs. server, ms, whole run
What changed vs. the previous tag
Parent: node-express-v04-cte-writes. One change: every query is a prepared statement (a pg named query, { name, text, values }). The app derives a stable name per SQL text (q1, q2, ...), so each pooled connection parses and plans each statement once and then only binds and executes it. Verified on the droplet: a named query run twice on one connection shows one entry in pg_prepared_statements with 2 executions. All endpoints return the same responses and status codes as v04.
Full configuration
App: apps/node-express — Express 5.3.0, pg 8.23.1, plain SQL, no ORM (app code from commit f7166fe)
Runtime: Node v24.21.0, NODE_ENV=production, default heap, no flags
App processes/workers: 1 (systemd bench-app, no cluster/pm2)
DB connections: pg.Pool defaults, max 10
Queries: prepared statements (named queries)
Writes: single statement (CTE), no explicit transactions
Server timing: Server-Timing: conn, db, app, total on every response
Load generator: DigitalOcean droplet in blr1, 4 vCPU / 8 GB shared (do-blr1-loadgen-4vcpu-8gb), k6 v2.3.0, traffic to the target's private IP 10.122.0.2 (≈ 2 ms RTT)
Observations
conn (pool wait) is still 92–95 % of server time at the saturated levels; db p95 is 29–30 ms, the lowest of any tag at saturation.
At 1000 VUs (not saturated) the CPU cost per request is 1.67 ms vs. 1.57 ms for v02. This contradicts the lower Postgres share, so host speed differed between the two runs; v05 ran before the host-speed probe existed.
Time outside the handler (client − server p50) is 21–23 ms at saturation, as in v04.
Someone ran htop on the droplet during the profiling run (1.3 % CPU). Interactive tools on the droplet during official runs take CPU from the app; avoid them.
Next idea
node-express-v06-no-memoize (parent v05): enable_memoize = off for the app's database role, the only change. It removes the per-execution Memoize setup in the feed queries (≈ 10 % of Postgres CPU in the profile). Compare at 1000 VUs (CPU per request, now with the host-speed probe) plus edge levels.