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

python-fastapi-v01-baseline

FastAPI 0.143.0 + uvicorn 0.54.0 (asyncio loop, h11) · asyncpg 0.32.0 · pool: none (new connection per request) · Node v24.21.0 · Postgres 16.15 · load from do-blr1-loadgen-4vcpu-8gb · app d21ccdf

Capacity60 VUs 29.9 req/s steady
First failing level70 VUs
Highest throughput seen35.8 req/s
Pass rulep50 < 500 · p95 < 800 · p99 < 1000 ms
errors < 1 %
Steady throughput29.9req/s · 1,793 req/min
Client p95 / p99490 / 619ms, steady phase
Server time p50109.1ms inside the app
Spent getting a connection75 %of server p50 (82.0 ms)
CPU (1 vCPU)87 %Node 36 · Postgres 49
Memory used397 MBof 961 MB · Node 53 · PG 46

Summary

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).

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 %
60Pass29.91154906190.00109 / 45682 / 36587 (36 / 49)3978
70Failp95 1006>=800ms, p99 1182>=1000ms32.22131,0061,1820.00199 / 934156 / 73993 (38 / 52)41410
100Failp50 955>=500ms, p95 1722>=800ms, p99 1969>=1000ms35.89551,7221,9690.00886 / 1,607714 / 1,273100 (40 / 56)4499

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

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.

Full configuration

Observations

Next idea

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).