diff options
| author | eunhhu <[email protected]> | 2026-09-26 17:39:03 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-09-26 17:39:03 +0100 |
| commit | 62f4c51920129216ea779118c341379b5e9f4d7c (patch) | |
| tree | 4ab29324b457d5afeb27bf72a0d503dd7844b561 /benchmarks/http | |
| parent | 93aeb3b1e73d096bd22813955bdbe3b4c8ddaf80 (diff) | |
| download | pure-62f4c51920129216ea779118c341379b5e9f4d7c.tar.gz pure-62f4c51920129216ea779118c341379b5e9f4d7c.zip | |
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.
Diffstat (limited to 'benchmarks/http')
| -rw-r--r-- | benchmarks/http/README.md | 9 | ||||
| -rw-r--r-- | benchmarks/http/run.py | 15 |
2 files changed, 20 insertions, 4 deletions
diff --git a/benchmarks/http/README.md b/benchmarks/http/README.md index b253dad..94b228b 100644 --- a/benchmarks/http/README.md +++ b/benchmarks/http/README.md @@ -22,3 +22,12 @@ python3 run.py --module editor.pmod --directory /var/tmp # 저장소를 둘 � python3 run.py --module editor.pmod --workloads put --rounds 5 --seconds 3 \ --only pure-serve,pure-serve-3,axum-durable,axum-atomic ``` + +앱 벤치마크([077](../../docs/research/077-apps-as-http-services.md))는 aup로 쓴 점수판(`scores.aup`)을 pure-serve가 보기와 +입력으로 내놓는 것과, 같은 점수판을 axum·drogon으로 손수 쓴 것을 비교한다. + +```sh +aup build scores.aup -o scores.pmod +python3 run.py --module scores.pmod --suite app --rounds 3 --seconds 4 \ + --only pure-serve,pure-serve-2,axum-memory,axum-durable,drogon-memory,drogon-durable +``` 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(',')] |
