aboutsummaryrefslogtreecommitdiffstats
path: root/serve
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-10-01 08:52:43 +0100
committereunhhu <[email protected]>2026-10-01 08:52:43 +0100
commit94e7bb87bce6821e91734f1fcbb6cfd61a008049 (patch)
tree6eb3f11da43583a3a3e4a13e360005ab5340920f /serve
parent99b221927c6feb595b7758ae9bf8370054028fae (diff)
downloadpure-94e7bb87bce6821e91734f1fcbb6cfd61a008049.tar.gz
pure-94e7bb87bce6821e91734f1fcbb6cfd61a008049.zip
Push a turn's sends to a link at once, and round only the links that want one (017, 2b-1)
The sending loop was woken by every record queued while it slept: the owner queues one by one, the loop caught up and slept between them, and every link took a round on every wake. Four links sent 64k packets of 12 records where threads sent 40k of 20, and ran at 257k sends/s against 581k. The owner now queues a turn's sends and pushes each link once; the loop rounds a link only when its socket has answers, it was pushed, or its time came.
Diffstat (limited to 'serve')
-rw-r--r--serve/serve.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/serve/serve.c b/serve/serve.c
index b5112d2..86e38f8 100644
--- a/serve/serve.c
+++ b/serve/serve.c
@@ -1829,6 +1829,7 @@ static void feed_outlets(Executor *ex) {
delivered = wire ? pure_wire_delivered(wire) : link ? pure_link_delivered(link) : local_delivered(local);
size_t held = wire ? pure_wire_held(wire) : link ? pure_link_held(link) : local_held(local), at = ex->outlet_from[i];
at = at > gone ? at - (size_t)gone : 0;
+ uint64_t before = queued;
for (; at < ex->app.sent_saved; ++at) {
uint32_t of;
uint64_t seq;
@@ -1844,6 +1845,7 @@ static void feed_outlets(Executor *ex) {
queued = seq;
held += payload.size;
}
+ if (link && queued != before) pure_link_push(link); /* the turn's together */
ex->outlet_from[i] = at;
}
uint64_t now = ex->local_count ? now_ms() : 0;