After a shutdown the first subscription with a cursor is sent its first message within a second, from events.index. After a kill or a power cut the server reads every account's files first: about 8 s for 100,000 accounts on a Mac, the files in the system's cache (spec/STORE.md, "The firehose after a start").
What was weighed and not built
An entry of each event made durable before its commit (one log for all, synced first): exact after a power cut, and measured before Wal::wait shared its syncs: writes from 16 writers fell from 413 a second to 130 on the runner. With syncs shared it would cost each commit one more sync it waits through, about 8 ms on the runner's disk beside the 19 its own takes.
A mark, made durable, of each account's first event since the index was last written. A commit to an account not written to lately waits on the service log's sync as well as its own: for many accounts each written to seldom, which is what a large server holds, that is most commits.
The index written again every minute, with each account's log's generation and length, and a start reading only the accounts whose log is no longer as the index says: nothing added to a write, and exact (a log only grows or is replaced by a later generation). But the index holds every event in the window, 36 bytes each, and every account, about 44: at 100 events a second and a window of a day that is 300 MB, written whole each time. It has to be kept as a log of its own with a table under it: a second store for the firehose.
What it comes to
The third, done properly, is one log for all accounts' events that is itself what a replay reads (the store benchmark's "The firehose replayed": 1.1 million events a second from such a log, the first event from a cursor in 8 µs), with what a start must read after a kill bounded by what was written since its last sync, not by the accounts. That is a change to where events are kept, to be designed as one.
Beside it
The events in the window are held in memory, one entry each (events::Seq::events), and events.index is read whole at a start: both follow the events made in the window, not the accounts. At 100 events a second and a day's window that is several hundred MiB, within spec/STORE.md's bound only because the bound allows 4 KiB an account.
After a shutdown the first subscription with a cursor is sent its first message within a second, from
events.index. After a kill or a power cut the server reads every account's files first: about 8 s for 100,000 accounts on a Mac, the files in the system's cache (spec/STORE.md, "The firehose after a start").What was weighed and not built
Wal::waitshared its syncs: writes from 16 writers fell from 413 a second to 130 on the runner. With syncs shared it would cost each commit one more sync it waits through, about 8 ms on the runner's disk beside the 19 its own takes.What it comes to
The third, done properly, is one log for all accounts' events that is itself what a replay reads (the store benchmark's "The firehose replayed": 1.1 million events a second from such a log, the first event from a cursor in 8 µs), with what a start must read after a kill bounded by what was written since its last sync, not by the accounts. That is a change to where events are kept, to be designed as one.
Beside it
The events in the window are held in memory, one entry each (
events::Seq::events), andevents.indexis read whole at a start: both follow the events made in the window, not the accounts. At 100 events a second and a day's window that is several hundred MiB, withinspec/STORE.md's bound only because the bound allows 4 KiB an account.