aboutsummaryrefslogtreecommitdiffstats
path: root/research/experiments/019-idle-links/run.py
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-29 07:22:19 +0100
committereunhhu <[email protected]>2026-09-29 07:22:19 +0100
commit5dbf6a536627f9a29f7358c547426218aa6f23c1 (patch)
tree3e92fc3358b83877d694a76ab8c264091df3af39 /research/experiments/019-idle-links/run.py
parent7c6595c8a9229a2208ed5bd75b2dee249187923d (diff)
downloadpure-5dbf6a536627f9a29f7358c547426218aa6f23c1.tar.gz
pure-5dbf6a536627f9a29f7358c547426218aa6f23c1.zip
Make the load generator's devices real link senders, many on one thread
links.c was a second implementation of the packet format; each device is now a PureLinkSender on a socket of its own, keyed with a secret made outside (pure_link_sender_shared: a key kept elsewhere, or a test's many). M1 (1k, 10k) and M2 (10k, kill -9) pass with it: no silent step, caught up in 0.2 s, every order applied once; the slowest store after the restart is now the sender's 1 s wait for a word of the save (STORED_WAIT), where the old devices tried again after 200 ms.
Diffstat (limited to 'research/experiments/019-idle-links/run.py')
-rw-r--r--research/experiments/019-idle-links/run.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/research/experiments/019-idle-links/run.py b/research/experiments/019-idle-links/run.py
index d10cb3f..15ae2de 100644
--- a/research/experiments/019-idle-links/run.py
+++ b/research/experiments/019-idle-links/run.py
@@ -138,7 +138,7 @@ def one(n, work, keys, module, idle_ms, window):
links = [ROOT / 'build/links', 'send', keys, module, 'order', '127.0.0.1', link_port, node_key]
cpu = cpu_ms(node.pid)
sent = subprocess.run([str(a) for a in links + [0, n, 1, window]], capture_output=True, text=True)
- assert sent.returncode == 0, sent.stderr
+ assert sent.returncode == 0, sent.stderr + sent.stdout
row['send'] = json.loads(sent.stdout)
row['node_cpu_ms_per_send'] = round((cpu_ms(node.pid) - cpu) / n, 4)
row['sent'] = memory(node.pid)
@@ -148,7 +148,7 @@ def one(n, work, keys, module, idle_ms, window):
first = random.Random(n).randrange(0, n - wake + 1)
cpu = cpu_ms(node.pid)
woken = subprocess.run([str(a) for a in links + [first, wake, 2, 1]], capture_output=True, text=True)
- assert woken.returncode == 0, woken.stderr
+ assert woken.returncode == 0, woken.stderr + woken.stdout
row['wake'] = json.loads(woken.stdout)
row['node_cpu_ms_per_wake'] = round((cpu_ms(node.pid) - cpu) / wake, 4)
assert view(port, 'count') == n + wake
@@ -625,10 +625,11 @@ def main():
with tempfile.TemporaryDirectory(prefix='pure-m1-quic-', dir=args.store) as directory:
quic(counts, Path(directory), args.window, args.out)
return
- subprocess.run(['make', '-s', '-C', str(ROOT), 'build/pure-serve', 'build/pure-crypto.so', 'build/libpure.a'], check=True)
- subprocess.run(['cc', '-O2', '-g', '-std=c17', '-Wall', '-Wextra', '-Werror', f'-I{ROOT}/core',
- str(Path(__file__).parent / 'links.c'), str(ROOT / 'build/libpure.a'), '-lcrypto', '-lm', '-pthread',
- '-o', str(ROOT / 'build/links')], check=True)
+ subprocess.run(['make', '-s', '-C', str(ROOT), 'build/pure-serve', 'build/pure-crypto.so', 'build/libpure.a',
+ 'build/libpure-link.a'], check=True)
+ subprocess.run(['cc', '-O2', '-g', '-std=c17', '-Wall', '-Wextra', '-Werror', f'-I{ROOT}/core', f'-I{ROOT}/link',
+ str(Path(__file__).parent / 'links.c'), str(ROOT / 'build/libpure-link.a'), str(ROOT / 'build/libpure.a'),
+ '-lcrypto', '-lm', '-pthread', '-ldl', '-o', str(ROOT / 'build/links')], check=True)
with tempfile.TemporaryDirectory(prefix='pure-m1-', dir=args.store) as directory:
work = Path(directory)
source = work / 'receiver.aup'