aboutsummaryrefslogtreecommitdiffstats
path: root/research/experiments/019-idle-links/run.py
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 /research/experiments/019-idle-links/run.py
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 'research/experiments/019-idle-links/run.py')
-rw-r--r--research/experiments/019-idle-links/run.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/research/experiments/019-idle-links/run.py b/research/experiments/019-idle-links/run.py
index 0d18c1d..bfe5b92 100644
--- a/research/experiments/019-idle-links/run.py
+++ b/research/experiments/019-idle-links/run.py
@@ -490,7 +490,7 @@ def drain_pure(work, n, size):
b, _ = start([ROOT / 'build/pure-serve', '--module', receiver_module, '--store', work / 'drain-b', '--port', port_b,
'--threads', '2', '--key', work / 'b.key', '--link-port', link_port, '--senders', work / 'drain-senders'])
cpu = {name: (thread_cpu(pid, None), thread_cpu(pid, thread)) for name, pid, thread in
- (('sender', a.pid, 'pure-link'), ('receiver', b.pid, 'pure-listen'))}
+ (('sender', a.pid, 'pure-send'), ('receiver', b.pid, 'pure-listen'))}
import http.client
connection = http.client.HTTPConnection('127.0.0.1', port_b, timeout=30)
first = None
@@ -507,7 +507,7 @@ def drain_pure(work, n, size):
seconds = now - first[0]
row = {'messages': n, 'item_bytes': size, 'first_seen': first[1], 'seconds': round(seconds, 4),
'per_second': round((n - first[1]) / seconds) if seconds else None}
- for name, pid, thread in (('sender', a.pid, 'pure-link'), ('receiver', b.pid, 'pure-listen')):
+ for name, pid, thread in (('sender', a.pid, 'pure-send'), ('receiver', b.pid, 'pure-listen')):
total, link = thread_cpu(pid, None) - cpu[name][0], thread_cpu(pid, thread) - cpu[name][1]
row[f'{name}_cpu_us_per_message'] = round(total * 1000 / n, 2)
row[f'{name}_link_cpu_us_per_message'] = round(link * 1000 / n, 2)