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

node-express-v06-feed-cache-1s

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 e4346d2

Capacity3,000 VUs 1,541.0 req/s steady
First failing level3,200 VUs
Highest throughput seen1,604.2 req/s
Pass rulep50 < 500 · p95 < 800 · p99 < 1000 ms
errors < 1 %
Steady throughput1,541.0req/s · 92,462 req/min
Client p95 / p99573 / 855ms, steady phase
Server time p507.6ms inside the app
Spent getting a connection0 %of server p50 (0.0 ms)
CPU (1 vCPU)98 %Node 60 · Postgres 30
Memory used541 MBof 961 MB · Node 156 · PG 130

Summary

Capacity: 3000 VUs at 1541 req/s (92,462 req/min), steady p50 29 ms / p95 573 ms / p99 855 ms, 0 % errors. The first failing level is 3200 VUs: 1604 req/s, p99 1641 ms (limit 1000), still 0 % errors. Every level from 1000 to 3000 VUs passed. 2.1× v05's capacity in VUs (1400) and 2.4× in req/s (645), the biggest step since the pool (v02). Labelled trade-off: the global feed can be up to 1 s stale.

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,000Pass543.028240.001 / 40 / 053 (33 / 12)47234
1,500Pass810.1333620.001 / 130 / 073 (46 / 19)49760
2,000Pass1,079.1448960.001 / 260 / 879 (49 / 22)50196
2,500Pass1,324.8121924360.001 / 1660 / 12792 (57 / 27)51596
3,000Pass1,541.0295738550.008 / 5520 / 45298 (60 / 30)54198
3,200Failp99 1641>=1000ms1,604.2427251,6410.0019 / 7100 / 48299 (60 / 31)54897

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-v05-prepared. One change: GET /posts (global feed, all pages) is cached in the Node process for 1 s. Key limit:before (validated values), value = the serialized JSON body, sent with res.type('json').send(...) (same Content-Type: application/json; charset=utf-8 and ETag as res.json). The TTL counts from the moment the query starts. Concurrent misses for one key share one query (single-flight: the cache holds the pending promise); a failed query is removed from the cache so the next request retries. Expired entries are swept every 10 s, when the app also logs feed cache: hit=… miss=… keys=…. No invalidation on writes: a new post or a new like/comment count shows in the global feed after at most 1 s (verified on the droplet). The other endpoints are unchanged (/posts/:id, /users/:id/posts and /me/posts use random ids or are per user, so a cache would rarely hit). App code from commit 887f64c.

Full configuration

Observations

Next idea

node-express-v07-feed-cache-5s (parent v06): the same cache with TTL 5 s, the only change (user's plan). Compare at 1000 VUs (CPU per request) and at the edge (3000 / 3200 VUs). Expect a small difference: hits are already 99.6 %, so 5 s only removes ≈ 2 refresh queries per second and makes the refresh stalls 5× rarer.