aboutsummaryrefslogtreecommitdiffstats
path: root/research/experiments
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-27 19:03:34 +0100
committereunhhu <[email protected]>2026-09-27 19:03:34 +0100
commit8019260926dcebe4f4be99cb5f92f84fbc9cd6d3 (patch)
tree06e407f4ba8606741df98bb1c6dcf3b7eed8fa12 /research/experiments
parent944ab4fe95596127ec3c517037bad8fe6102dfe4 (diff)
downloadpure-8019260926dcebe4f4be99cb5f92f84fbc9cd6d3.tar.gz
pure-8019260926dcebe4f4be99cb5f92f84fbc9cd6d3.zip
Map OpenSSL only in a server that uses it
Linking OpenSSL cost every pure-serve 2.3 MiB of resident memory, 0.66 MiB of it the process's own (relocated data), though most servers never reach an https receiver or seal a send. The code that uses OpenSSL (TLS to https receivers, sealing) is now built as pure-crypto.so beside pure-serve and exports one table; pure-serve maps it the first time a wire to an https URL opens or a key is read or a seal wired (serve/crypto.c), and a missing library is reported at startup. What needs no OpenSSL, a key's hex and the suite this CPU seals with, stays in pure-serve. An idle server: RSS 4,496 -> 2,320 kB, PSS 1,639 -> 881 kB, private dirty 1,296 -> 864 kB. A static OpenSSL was measured too and is worse (RSS 3.8 MiB, but 2.3 MiB private: all of its tables relocated). The checks, https webhooks and sealed sends included, pass unchanged.
Diffstat (limited to 'research/experiments')
-rw-r--r--research/experiments/013-parallel-syncs/variants.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/research/experiments/013-parallel-syncs/variants.py b/research/experiments/013-parallel-syncs/variants.py
index ee49d2a..0b07243 100644
--- a/research/experiments/013-parallel-syncs/variants.py
+++ b/research/experiments/013-parallel-syncs/variants.py
@@ -41,10 +41,11 @@ def build(work, name, patches):
store.write_text(source)
binary = work / f'pure-serve-{len(name)}'
subprocess.run(['cc', '-O2', '-std=c17', f'-I{ROOT / "core"}', f'-I{ROOT / "serve"}', '-DPURE_ASYNC_EFFECTS', '-pthread',
- *[str(ROOT / s) for s in ('serve/serve.c', 'serve/deliver.c', 'serve/message-json.c', 'core/module.c',
+ *[str(ROOT / s) for s in ('serve/serve.c', 'serve/deliver.c', 'serve/message-json.c', 'serve/crypto.c',
+ 'core/module.c',
'core/module-list.c', 'core/module-save.c', 'core/module-text.c',
'core/module-store.c')], str(store), str(ROOT / 'core/runtime.c'),
- '-lssl', '-lcrypto', '-lm', '-o', str(binary)], check=True)
+ '-lm', '-o', str(binary)], check=True)
return binary