From eb37aad3ae7f9df1d6c0b09108e3a2d69d0d4d82 Mon Sep 17 00:00:00 2001 From: eunhhu Date: Sun, 27 Sep 2026 07:30:51 +0100 Subject: Read JSON bodies in place, groups included (082) pure-serve no longer copies a JSON body's strings into the message's payload. The ingress is the prefix, a table of each field's start and size, and the body as it came; the connection thread scans the body once, puts numbers into the prefix and records where each string is. Only a string with escapes is unescaped, over itself (it never grows). A group of fields comes as an object inside the body and, for a fixed field, as its path in the query (?to.zip=7). A group where a field belongs, a value where a group does, an array or true/false/null is json_type; an unknown member, inside a group too, json_field. The string scan and UTF-8 checks now pass over eight bytes at a time while none needs a look (pure_utf8_step, so every text check gains). On the Pi, posting {"name":"k","text":"x..."} to a stateless app went from 652-655 to 3,737-3,953 requests/s with 256 KiB of text (server CPU 1.52 to 0.25 ms a request, peak RSS 5.2 to 3.2-3.4 MiB) and from 29.1k to 76.3-76.7k/s with 4 KiB; the load generator gains a json method and benchmarks/http/echo.aup is the app. --- benchmarks/http/README.md | 3 +++ 1 file changed, 3 insertions(+) (limited to 'benchmarks/http/README.md') diff --git a/benchmarks/http/README.md b/benchmarks/http/README.md index 3672c08..af9f62d 100644 --- a/benchmarks/http/README.md +++ b/benchmarks/http/README.md @@ -32,6 +32,9 @@ 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 ``` +JSON 본문의 비용은 상태 없는 앱 [echo.aup](echo.aup)에 `load PORT 연결 초 json 1 keep-alive 본문바이트`로 잰다 +(`{"name":"k","text":"x…"}`를 `POST /inputs/echo`로, [082](../../docs/research/082-json-in-place.md)). + 앱 벤치마크의 마지막 작업(`mixed`)은 내구성 점수 POST 8연결과 합계 GET 56연결을 부하 생성기 둘로 함께 보내, 쓰기가 동기화하는 동안 읽기가 기다리는지 본다([080](../../docs/research/080-snapshot-reads.md)). 두 행(posts, reads)으로 나오고, CPU 1초당 답은 두 행을 합친 것이다. -- cgit v1.2.3