From c7ae77cdf4623c3eb07935081510478be9063024 Mon Sep 17 00:00:00 2001 From: eunhhu Date: Sat, 26 Sep 2026 05:48:40 +0100 Subject: Shard pure-serve across cores A burst now looks at the store once (pure_store_pin) instead of once per request; another shard's commit ends before its answer is sent, so a request made after that answer still reads it. With this alone one thread serves 125k small keep-alive reads per second, as many as axum on three cores, with a shorter p99. --threads N runs a shard per thread: its own SO_REUSEPORT listener, epoll set, runtime domain, app and store handle. Writer sessions of the tree store now take turns inside a process with a mutex (the file lock belongs to the process and does not keep threads apart), and revisions settle concurrent edits of a key. A module with states runs on one thread. Three shards serve 151k reads per second; they still commit one by one, so durable writes and 1 MiB reads are better on one thread for now, which stays the default. Note 075 records the numbers. --- prototypes/connections/state.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'prototypes/connections/state.h') diff --git a/prototypes/connections/state.h b/prototypes/connections/state.h index 25c0f61..60d333c 100644 --- a/prototypes/connections/state.h +++ b/prototypes/connections/state.h @@ -30,6 +30,10 @@ PureResult pure_store_open(const char *path, PureStore **out); void pure_store_close(PureStore *); PureResult pure_store_draft(PureStore *, const char *key, PureDraft **out); PureResult pure_store_state(PureStore *, const char *name, PureDraft **out); +/* Pinned, drafts open at the version found when pinning, without checking + * the file each time (a host pins for one burst of requests); commits made + * through the handle still move it on. */ +PureResult pure_store_pin(PureStore *, bool pinned); /* Memory only. Fails without change on a bad range or when memory runs out. */ PureResult pure_draft_splice(PureDraft *, size_t offset, size_t remove, PureSpan insert); size_t pure_draft_size(const PureDraft *); -- cgit v1.2.3