From 62f4c51920129216ea779118c341379b5e9f4d7c Mon Sep 17 00:00:00 2001 From: eunhhu Date: Sat, 26 Sep 2026 17:39:03 +0100 Subject: Record the app service against axum and drogon (077) The scoreboard, 22 lines of aup served by its views and inputs, against the same service written by hand in axum and drogon on the Pi: durable posts about 76 times as many, reads level with drogon and ahead of axum with the least CPU and memory. The note keeps what the profile showed on the way (the kernel's share of a single thread, integers through printf, an owner that saved too early) and what comes next. run.py gains pure-serve-2 and waits for a server that prints its port before it listens. --- benchmarks/http/run.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'benchmarks/http/run.py') diff --git a/benchmarks/http/run.py b/benchmarks/http/run.py index a09b4ef..7c5ab98 100644 --- a/benchmarks/http/run.py +++ b/benchmarks/http/run.py @@ -75,8 +75,13 @@ def put(port, key, body, expected): def post_score(port, name): - connection = http.client.HTTPConnection('127.0.0.1', port, timeout=30) - connection.request('POST', '/inputs/score?points=1', name.encode(), {'Content-Length': str(len(name))}) + for attempt in range(50): # a server may print its port a moment before it listens + try: + connection = http.client.HTTPConnection('127.0.0.1', port, timeout=30) + connection.request('POST', '/inputs/score?points=1', name.encode(), {'Content-Length': str(len(name))}) + break + except ConnectionRefusedError: + time.sleep(0.05) response = connection.getresponse() response.read() connection.close() @@ -130,6 +135,8 @@ def main(): '--budget', str(args.budget)], 'pure-serve-3': lambda d: [PURE / 'build/pure-serve', '--module', args.module, '--store', d, '--port', '0', '--budget', str(args.budget), '--threads', '3'], + 'pure-serve-2': lambda d: [PURE / 'build/pure-serve', '--module', args.module, '--store', d, '--port', '0', + '--budget', str(args.budget), '--threads', '2'], 'axum-memory': lambda d: [axum, '--port', '0'], 'axum-durable': lambda d: [axum, '--port', '0', '--durable', d], 'axum-atomic': lambda d: [axum, '--port', '0', '--atomic', d], @@ -153,8 +160,8 @@ def main(): ('total, 64 conn, keep-alive', dict(connections=64, method='total', keys=64, mode='keep-alive')), ('page 20 rows, 64 conn, keep-alive', dict(connections=64, method='page', keys=64, mode='keep-alive')), ] - for name in ('pure-program', 'pure-serve-3', 'axum-atomic', 'drogon-atomic'): - del servers[name] # one owner of the board's states; atomic is durable for a log + for name in ('pure-program', 'axum-atomic', 'drogon-atomic'): + del servers[name] # atomic is durable for a log already if args.workloads: workloads = [w for w in workloads if re.search(args.workloads, w[0])] chosen = [name for name in servers if not args.only or name in args.only.split(',')] -- cgit v1.2.3