diff options
| author | eunhhu <[email protected]> | 2026-09-26 05:40:20 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-09-26 05:40:20 +0100 |
| commit | 7771461a93f993425f97d4e05c91e64d17179e60 (patch) | |
| tree | 34fb91b6d3934f1b441f84b294961074a3be1288 /docs/research | |
| parent | e4bc782d09fe1c80098a38380b3959863dfe188f (diff) | |
| download | pure-7771461a93f993425f97d4e05c91e64d17179e60.tar.gz pure-7771461a93f993425f97d4e05c91e64d17179e60.zip | |
Serve modules over persistent connections
pure-serve replaces the module mode of server.c, which goes back to what
it was. It keeps the document contract, the runtime core (a work slot per
connection, the payload budget, core-owned ingress, borrowed PUT replies)
and the group commits, and adds what server.c lacked: HTTP/1.1 persistent
connections with in-order pipelining, an edge-triggered epoll owner
thread, up to 1,024 connections allocated as they arrive and reused, one
writev per answer, and documents opened through a store handle.
On the Pi 5 with one thread it serves 106k small keep-alive reads per
second (axum on three cores: 126k) at the same p99, 1,741 1 MiB reads
(axum: 1,370), and 1,126 durable writes from 64 connections (crash-safe
axum: 372), in 7.3 MiB against axum's 17-20 MiB. Note 075 has the table.
Diffstat (limited to 'docs/research')
| -rw-r--r-- | docs/research/075-http-host-against-axum.md | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/docs/research/075-http-host-against-axum.md b/docs/research/075-http-host-against-axum.md index 96814d3..308363e 100644 --- a/docs/research/075-http-host-against-axum.md +++ b/docs/research/075-http-host-against-axum.md @@ -52,3 +52,26 @@ PUT은 연결마다 자기 키 앞에 16 B를 넣고 받은 ETag로 다음 `If-M 4. 모듈 서버의 무복사 GET. 중단 기준: 어떤 단계든 메모리가 axum보다 커지거나, 저장 보장(확인 응답 = 저장됨, `kill -9` 검사)이 깨지면 그 방식은 버린다. + +## 1단계 결과: `pure-serve` (소유 스레드 하나) + +새 호스트 [`serve.c`](../../prototypes/connections/serve.c): 지속 연결·파이프라이닝, edge-triggered epoll, 연결 +최대 1,024(받을 때 할당), `writev` 응답, 같은 런타임 코어와 묶음 커밋. 같은 조건에서 다시 쟀다. + +`strace -c`로 보니 GET 하나마다 저장소 draft를 여닫느라 시스템 호출이 9번(파일·디렉터리 열기, `fstat` 두 번, +전체 `mmap`/`munmap`, head 읽기)이었다. 저장소 핸들(`pure_store_open`)이 매핑을 공유하고 열 때 파일이 바뀌었는지만 +본다(2번). + +| 작업 | 이전 Pure | pure-serve, 핸들 전 | **pure-serve** | axum 메모리(3코어) | axum 충돌 안전 | +|---|---:|---:|---:|---:|---:| +| GET 64 B, keep-alive | 23,892 | 57,971 | **106,447** (p99 736) | 126,160 (p99 768) | 126,865 | +| GET 64 B, 매번 새 연결 | 23,852 | 22,912 | 23,315 | 21,947 | 22,703 | +| GET 1 MiB, keep-alive | 1,197 | 1,537 | **1,741** | 1,370 | 1,354 | +| PUT 저장 보장, 연결 64 | 191 | 1,081 | **1,126** | – | 372 | +| PUT 저장 보장, 연결 8 | 171 | 333 | **336** | – | 63 | + +최대 RSS: pure-serve 7.3 MiB, axum 17.4–19.6 MiB. + +- 코어 하나로 axum(코어 3개)의 84%(작은 keep-alive GET), p99는 같다. 큰 읽기는 27% 빠르다. +- 저장 보장 쓰기는 충돌 안전 axum의 3.0–5.3배, 안전하지 않은 axum(429/s)보다도 빠르다. +- 남은 차이는 코어 수다. 다음은 2단계(코어마다 소유 스레드)다. |
