1 GB server test · protocol v2 · Ubuntu 24.04.5 LTS on a $6 droplet (1 vCPU / 1 GB)
Capacity: 60 VUs at 29.9 req/s (1,793 req/min), steady p50 115 ms / p95 490 ms / p99 619 ms, 0 % errors (not marginal: p95 and p99 38–39 % under their limits). The first failing level is 70 VUs: 32.2 req/s, p95 1006 ms / p99 1182 ms (limits 800 / 1000), still 0 % errors. At 100 VUs: 35.8 req/s, p50 955 ms. Python's no-pool baseline reaches 60 % of node-express v01's capacity (100 VUs / 46.7 req/s, same design: no pool, no cache, one connection per request).
conn (connect + SCRAM auth + close) 82 ms + db 24 ms + app 1.8 ms. Past the edge the wait grows almost entirely in conn (p95 365 → 739 → 1273 ms at 60 / 70 / 100 VUs): every request makes Postgres start a backend process and check a SCRAM password.jsonable_encoder, asyncpg's connect/auth. The higher Postgres cost is likely asyncpg's protocol: it prepares every query (Parse + Describe, then Bind + Execute) on the fresh connection, where node-postgres sent unnamed parameterised queries in one round trip.too many clients: connections stay short-lived, at most one per VU (≤ 100).python-fastapi-v02-pool — an asyncpg pool (max 10), the only change. On Node the pool removed the per-request connect + auth (≈ 80 % of server time) and lifted capacity from 100 to 1350 VUs.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 % |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 60 | Pass | 29.9 | 115 | 490 | 619 | 0.00 | 109 / 456 | 82 / 365 | 87 (36 / 49) | 397 | 8 |
| 70 | Failp95 1006>=800ms, p99 1182>=1000ms | 32.2 | 213 | 1,006 | 1,182 | 0.00 | 199 / 934 | 156 / 739 | 93 (38 / 52) | 414 | 10 |
| 100 | Failp50 955>=500ms, p95 1722>=800ms, p99 1969>=1000ms | 35.8 | 955 | 1,722 | 1,969 | 0.00 | 886 / 1,607 | 714 / 1,273 | 100 (40 / 56) | 449 | 9 |
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.
New stack apps/python-fastapi/, no parent (first Python tag). The design matches node-express v01 (the Node baseline): one process, no connection pool (a new asyncpg connection per request, closed before the response is sent; conn = connect + auth + close), no feed cache, writes as one CTE statement (as in every current stack), Server-Timing on every response. Idiomatic FastAPI: route decorators, handlers return dicts that FastAPI encodes (jsonable_encoder + json.dumps). Path, query and body parsing are done by hand so status codes and error bodies match the other stacks (FastAPI's own validation would answer 422 with a different body); unknown routes and methods answer 404 {"error":"not found"}; /docs and /openapi.json are off. Server-Timing comes from a plain ASGI middleware (outermost app middleware), which also ignores trailing slashes like the JavaScript routers. The parity check (39 requests on a fresh DB) gave responses identical to the node-http reference. App code from commit d21ccdf.
apps/python-fastapi — FastAPI 0.143.0 (Starlette 1.7.0, Pydantic 2.14.1), asyncpg 0.32.0, plain SQL, no ORM; all dependencies pinned in requirements.txt (app code from commit d21ccdf)--no-access-log, keep-alive timeout 5 s (default)bench-app)Server-Timing: conn, db, app, total on every responseshared_buffers=128MB, max_connections=100), localhost TCP, SCRAM authdo-blr1-loadgen-4vcpu-8gb), k6 v2.3.0, traffic to the target's private IP 10.122.0.2conn.app time stays ≈ 2 ms p50 / 5–6 ms p95 at every level: FastAPI's own work per request is small next to connection setup, but it runs on the same single vCPU as Postgres's backend start-up.app_log_tail.txt has no errors at any level.python-fastapi-v02-pool (parent v01): asyncpg.create_pool(max_size=10), one pooled connection per request, the only change (prepared statements are then cached per pooled connection). Start near the expected order of magnitude (Node v02: 1350 VUs; Python's higher app CPU per request suggests well below that, e.g. 400–800 VUs).