Architecture
One binary, four layers, no plugins. Understanding the shape of the codebase makes the rest of the documentation predictable.
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 — 64 KB response staging per connection; bodies above that spill to the heap (capped at 10 MB), and spills up to 256 KB are retained for reuse instead of re-allocated.
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.
