The layers
Where things live
Threads
There is no single shared pool — loop,
fs, and ffi each own a
separate 4-thread pool. See Concurrency for
the full inventory.
Hot-path design
- SoA connection table — 512 slots stored as parallel arrays with packed
2-byte flags (
ConnFlagsis apacked struct(u16)), so the hot loop touches cache lines, not objects. - Static per-slot buffers — 4 KB request read buffer (spills to the heap up to 1 MB per request, retaining up to 64 KB per slot within a 64 MB global budget) and 64 KB response staging per connection (spills to the heap up to 10 MB, retaining up to 256 KB for reuse).
HeadersDatarefcount — one heap object with an atomic refcount, shared byRequest/Response/Headersacross thread boundaries.- Zero-copy URLs — one allocation per URL; components are pooled slices.
- Worker messages — one small allocation plus a
memcpyper message. - Postgres arenas — per-job arena with a 32 KB retain cap plus a job freelist, so a warm query path allocates nothing.
Build options
All four are fetched by
./scripts/fetch-vendors.sh — they are not
committed. See Installation.