Documentation
¶
Overview ¶
Command daemon-cost measures what one process serving N clients costs against N processes serving one each.
It exists because the saving was never observed. `benchmarks/load-cost-resident` measured what a `serve` keeps -- `71,2 MB` of private dirty pages, flat in the number of clients -- and `kivgraph daemon` was written on the arithmetic that N of those become one. Arithmetic is not a measurement, and two things could make it wrong:
- The snapshot is already shared. It is the same mapped file in every server and those pages are clean, so the bytes at stake are only the private ones. A reader who expects the file's size to disappear is measuring the wrong thing.
- A daemon's private half is not constant. It builds an MCP server per accepted session -- eleven tool registrations, a decoder, buffers -- so its cost grows with the number of clients. The question is not whether it saves, it is the slope: an arm that saves at two clients and not at eight would not be worth the command.
Both arms therefore read the same published generation from its file, and the sweep is what answers the question. A single client count cannot, so the one-client point is measured rather than skipped: it is where a daemon's own overhead would be visible with nothing to amortise it over.
This comment predicted that a daemon must be *worse* there -- same load, plus a session. Measured, it is neither: the proportion at one client is 0,966 to 1,015 over three runs, a megabyte of noise. The per-session server does not show up against the 66 MB the load costs. See report.md.