1 GB server test · protocol v2 · Ubuntu 24.04.5 LTS on a $6 droplet (1 vCPU / 1 GB)

node-express-v04-cte-writes

Express 5.3.0 · pg 8.23.1 · pool: pg.Pool defaults (max 10) · Node v24.21.0 · Postgres 16.15 · load from do-blr1-loadgen-4vcpu-8gb · app 4af516b

Capacity1,400 VUs 660.5 req/s steady
First failing level1,500 VUs
Highest throughput seen660.5 req/s
Pass rulep50 < 500 · p95 < 800 · p99 < 1000 ms
errors < 1 %
Steady throughput660.5req/s · 39,631 req/min
Client p95 / p99788 / 990ms, steady phase
Server time p50172.7ms inside the app
Spent getting a connection92 %of server p50 (158.9 ms)
CPU (1 vCPU)100 %Node 41 · Postgres 52
Memory used486 MBof 961 MB · Node 126 · PG 110

Summary

No measurable gain over v02. By the capacity rule (highest passing level) v04 scores 1400 VUs at 660 req/s, but that pass is marginal (p95 788 ms, 1.5 % under 800; p99 991 ms, 1 % under 1000), and the lower levels 1300 and 1350 VUs both failed. Read the capacity as "about 1300–1400 VUs, 540–660 req/s", the same band as the parent tag (v02, pool 10: 1350 VUs / 619 req/s). 1500 VUs fails (614 req/s, p95 1316 ms). 0 % errors everywhere.

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.

VUsResultreq/sp50p95p99Errors %ServerConnCPU % (Node / PG)Used MBLoad gen CPU %
1,300Failp50 532>=500ms, p95 1243>=800ms, p99 1515>=1000ms542.25321,2431,5150.00506 / 1,206488 / 1,184100 (42 / 50)49165
1,350Failp50 511>=500ms, p95 847>=800ms569.05118479530.00489 / 820472 / 802100 (43 / 51)50665
1,400Pass660.51937889900.00173 / 764159 / 742100 (41 / 52)48650
1,500Failp95 1316>=800ms, p99 1439>=1000ms613.64961,3161,4390.00474 / 1,274458 / 1,252100 (43 / 50)51665

Across levels

Client latency vs. users steady phase, ms; dashed = limits
Where 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/s
Latency over time 2 s windows, ms
Target droplet CPU % of 1 vCPU, memory used MB
p95 by endpoint client vs. server, ms, whole run

What changed vs. the previous tag

Parent: node-express-v02-pool (pool 10). v03 (pool 20) was worse and is not carried forward. One change: the writes that touch two tables are now one SQL statement with data-modifying CTEs instead of BEGIN / 2 queries / COMMIT:

A single statement is one transaction, so the writes stay atomic. Responses and status codes are unchanged (verified: new/repeat like and unlike, unknown post 404, unknown user 401, empty text 400). A concurrency check of 30 parallel likes by one user, 40 by different users and 20 parallel unlikes left like_count = rows in likes (31).

Full configuration

Observations

Next idea

node-express-v05-prepared (parent v04): named queries in pg ({ name, text, values }), so each pooled connection parses and plans every statement once and reuses the plan. Postgres uses half the CPU; parse/plan is a real part of it for these short indexed queries. Run one unsaturated level (1000 VUs) plus the edge levels.