aboutsummaryrefslogtreecommitdiffstats
path: root/prototypes/connections/state.h
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-26 05:48:40 +0100
committereunhhu <[email protected]>2026-09-26 05:48:40 +0100
commitc7ae77cdf4623c3eb07935081510478be9063024 (patch)
tree79430358736adab332b4d5bb61c9e7b78e67a30f /prototypes/connections/state.h
parent7771461a93f993425f97d4e05c91e64d17179e60 (diff)
downloadpure-c7ae77cdf4623c3eb07935081510478be9063024.tar.gz
pure-c7ae77cdf4623c3eb07935081510478be9063024.zip
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.
Diffstat (limited to 'prototypes/connections/state.h')
-rw-r--r--prototypes/connections/state.h4
1 files changed, 4 insertions, 0 deletions
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 *);