aboutsummaryrefslogtreecommitdiffstats
path: root/prototypes/connections/state.h
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-26 17:30:00 +0100
committereunhhu <[email protected]>2026-09-26 17:30:00 +0100
commit93aeb3b1e73d096bd22813955bdbe3b4c8ddaf80 (patch)
tree926f31f27d5f5786c27cd7fc37320a705b63705a /prototypes/connections/state.h
parentc2c62d03d09e11a8b8d2e2279111605c5593f5b0 (diff)
downloadpure-93aeb3b1e73d096bd22813955bdbe3b4c8ddaf80.tar.gz
pure-93aeb3b1e73d096bd22813955bdbe3b4c8ddaf80.zip
Serve an app with states from several connection threads
States have one owner, so a module with them ran on a single thread, which spent most of its time in the kernel sending and receiving. With --threads N such a module now gets N connection threads and one owner thread: connection threads accept, parse and answer; the owner takes the ready requests of every thread as one round, applies them in bursts with one save each and hands each thread back its applied requests (eventfd), which it completes and answers. A request's route and payload stay held by its thread's runtime core until completion, so an accepted event runs even when its connection closes first. After a burst that saved, the owner gathers requests until none has come for 100 µs (1 ms at most), so the requests its answers bring back share the next save as they would on one thread: 30 events per save became 50 and the median latency of a durable post fell from 5.4 to 3.5 ms. A page of 20 rows went from 87,600 to 141,900 answers a second on the Pi.
Diffstat (limited to 'prototypes/connections/state.h')
0 files changed, 0 insertions, 0 deletions