Skip to content

rust-iouring-WyattAu follow-up: the profiled hot path (-29% instructions/request) - #570

Open
WyattAu wants to merge 15 commits into
arjaythedev:mainfrom
WyattAu:profiled-path
Open

WyattAu wants to merge 15 commits into
arjaythedev:mainfrom
WyattAu:profiled-path

Conversation

@WyattAu

@WyattAu WyattAu commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #569 (merged at 65,000 — thank you). The run showed the wall moved to CPU: 100% at 145 µs/req. This PR is a callgrind-guided cut of the shim read path's per-request instructions (-29% measured):

  • write_escaped (was 25% of hot-path instructions): SWAR 8-byte chunk scan (hasless-0x20 + quote/backslash zero-tricks), memcpy the clean chunks, byte loop only on dirty chunks. First cut used a 0x21 threshold that flagged spaces as special and made it slower than the byte loop — a 256-value parity test now pins the semantics (json::esc_tests).
  • 8KB zero-init stack array per emit call (was 9% memset): replaced with a MaybeUninit Scratch reading only the prefix payload_copy wrote.
  • write_decimal (was 3.5%): two-digits-at-a-time table itoa.
  • Caller escape scratch widened to the 500x6 worst case — the old 2048-byte buffers would panic on a 500-char control-char body.

Measured: 231M -> 164M Ir per feed-25 + post-get + parse iteration on the seed (callgrind, same box); rig at 16k VUs: req/s 875 -> 2,849, p95 2.13s -> 74ms, 0.00% errors (0/175,995); 42/42 golden; 15/15 unit incl. the new escape parity.

…d itoa

The 2026-12-03 callgrind profile of the shim read path (231M Ir per
feed-25 + post-get + parse iteration — the ranking driver was
silently profiling the SQL fallback until begin_pass was added):

- write_escaped was 25%: a branchy per-byte loop (~12 Ir/byte).
  Now SWAR: 8-byte chunk scan (hasless 0x20 + quote/backslash
  zero-tricks), memcpy the clean chunks — 42% -> 10.7% of the run.
  First cut used a 0x21 threshold that flagged SPACES as special and
  made it slower than the byte loop; the parity test
  (json::esc_tests, all 256 byte values + space-only chunks) pins
  the semantics. Callers widened to the 500x6 worst case (the old
  2048-byte scratch panicked on a 500-char control-char body).
- feed/post emits zeroed an 8KB stack array per call (9% memset):
  replaced with MaybeUninit Scratch, reading only the prefix
  payload_copy wrote.
- write_decimal: two-digits-at-a-time table itoa (3.5% -> noise).

231M -> 164M Ir (-29%) per iteration on the same seed; with mimalloc
(shipped in build.sh now) on top. test: 42/42 golden, 15/15 unit
incl. the new escape parity.
- feed_emit: ONE merged range walk of the likes index per feed (seek
  below the smallest id, count into a sorted-id table, stop past the
  largest) instead of a seek+walk PER POST — the per-post seeks showed
  as TableMoveto+IndexMoveto ~12% of the feed cost. 164M -> 140.8M Ir
  per feed-25 + post-get + parse (-14%; -70% cumulative vs the merged
  baseline's SQL-fallback measurement of 468M).
- work_pass bounded to 512 requests: bounds the transient response
  memory per pass under saturation (the arjaythedev#569 run peaked at 1,436MB =
  22KB/conn — pass bodies + write backlog, not connection state; the
  rig now holds 16k VUs at ~64MB RSS).
- send_response takes the body by value: the pass-built body moved
  into the outbox frame, the old to_vec() second copy gone.

Rig note: back-to-back 16k-VU runs collide with the workstation's own
TIME_WAIT/port range (11.8k TIME_WAITs -> 42% 'errors' on run 2 that
vanished after the 60s expiry) — cooldown between high-connection
runs is mandatory methodology now; the errors dimension is robust
across runs (0.00-0.02%), rig latency p95 is noisy (74ms-9.9s on
near-identical binaries) so the ladder stays the latency arbiter.

test: 42/42 golden (exact bytes), 15/15 unit.
arjaythedev added a commit that referenced this pull request Dec 3, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@arjaythedev

Copy link
Copy Markdown
Owner

Benchmarked at 0532183 on the $12 box (1 vCPU / 2 GB, direct): 65,000 users held 5 min, 42/42 tests.

  • 6,398 req/s, p95 3.2 ms / p99 7.2 ms, 0 errors, 100 % CPU, 145 µs/request, 1,453 MB peak
  • 68,000 failed the 2-minute probe with 6.3 % connection resets, 70,000 with 7.5 % (both at 100 % CPU)

That ties the merged #569 row (65,000), so this isn't merged (follow-ups are merged only when they beat the merged row). The leaderboard keeps the #569 row and notes this run in a footnote.

The head moved to 852cf15 while this run was going. That commit is queued and gets its own run when its turn comes; I'll post the result here.

— benchmark agent

arjaythedev added a commit that referenced this pull request Dec 3, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@arjaythedev

Copy link
Copy Markdown
Owner

Re-run at the new head 852cf15 on the $12 box (1 vCPU / 2 GB, direct): 65,000 users held 5 min again, 42/42 tests.

  • 6,399 req/s, p95 2.7 ms / p99 6.4 ms, 0.001 % errors (23 × 500 on POST /posts), 100 % CPU, 145 µs/request, 1,454 MB peak
  • 68,000 failed the 2-minute probe with 6.3 % connection resets, 70,000 with 7.5 % (both at 100 % CPU)

Latency is a bit better than at 0532183, but the score still ties the merged #569 row (65,000), so this stays unmerged (follow-ups are merged only when they beat the merged row). The leaderboard keeps the #569 row and the footnote now has this run too. At 100 % CPU the limit is still CPU per request (~145 µs), so cutting that is what would move the score. If you push something that does, it gets a new run.

— benchmark agent

…the CPU sink

idle_close() scanned the ENTIRE connection table every event-loop
cycle. The scan is O(conns) cache-miss-bound work (each HashMap
entry ~100ns+): at 65k connections x hundreds of cycles/s that is
plausibly more than the entire CPU budget — the unexplained gap
between the measured ~10-15 µs/req read path and arjay's 145 µs/req
at 100% CPU. Invisible to callgrind: the ranking driver has no
connections (driver blind spot arjaythedev#2).

Rig A/B at 16k VUs, same connection count and RSS: the event-loop
CPU now ramps to ~18% where the previous build ramped to ~58% —
roughly 40% of a core recovered at 16k, scaling linearly with
connection count. A 65s idle timeout needs at most 1s scan
granularity: 0.65% CPU at 65k connections.

test: 42/42 golden.
The perf run (live server, 16k conns) put 8% of CPU into
rep_movs/copy_page_to_iter under pread64 — the shim's default 2MB
page cache thrashing on the feed's scattered users/likes pages: every
miss copies a 4KB page from the OS cache. The feed's working set is
scattered by design (random authors, likes across the whole index).

- shim: cache_size = 64MB + mmap_size = 1GB (rule 5 explicitly
  blesses SQLite's own page cache and mmap — fully-covered DB pages
  read in place, zero copy).
- writer: 16MB cache + 1GB mmap for its read-backs.

post-fix perf: no feed-server symbol above 6%; rep_movs gone from the
top. The perf ATTACH itself proved destabilizing at saturation
(199Hz DWARF sampling on the single core: a run with the profiler
attached threw 5.63% feed timeouts that vanished without it) —
future profiling at <=50Hz and only with CPU headroom.

test: 42/42 golden; rig 16k VUs = 0.10% err (414/380,130), p95 97ms,
2,825 req/s.
wal_autocheckpoint was 0 (WAL grows unbounded across a hold): the
live perf profile showed walFindFrame at 6.6% and degrading as the
wal-index frame set grew through a 5-minute run. Native PASSIVE
checkpointing at 4000 pages (~16MB) is cooperative with the shim's
short per-pass read txns — pages fold in as the reader mark advances
each cycle. Rule 6 unaffected (checkpoints fold pages into the DB;
synchronous=NORMAL still governs commit durability).

Rig (16k VUs, 120s): 0.00% errors (0/388,086), 2,878 req/s, p95
76ms, event-loop CPU ramp peaked 18% (idle-throttle + this), WAL
file size constant across the hold.

test: 42/42 golden.
The 8k-VU 50Hz live profile: sqlite3RunParser + yy_reduce = 2.7% —
the writer re-parsed its INSERT/SELECT SQL on every call (rusqlite
execute without a statement cache). prepare_cached on insert_post /
insert_like / created_at read-back caches the plans; rule 5
explicitly allows prepared statements (they cache the plan, not
data). Same commit bounds the WAL: wal_autocheckpoint 0 -> 4000
pages (~16MB, PASSIVE, cooperative with the shim's per-pass read
txn) — the live profile had walFindFrame at 6.6-7.4% and growing
with the unbounded log; WAL file size now constant across a hold.

test: 42/42 golden.
arjaythedev added a commit that referenced this pull request Dec 3, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@arjaythedev

Copy link
Copy Markdown
Owner

Benchmarked at 1b6ea51 on the $12 box (1 vCPU / 2 GB, direct): 65,000 users held 5 min, 42/42 tests.

  • 6,400 req/s, p95 1.3 ms / p99 3.5 ms, 0 errors, 57 % CPU, 83 µs/request, 1,433 MB peak
  • 68,000 failed the 2-minute probe with 6.3 % connection resets, 70,000 with 10.1 %, and CPU was only ~60–65 % there, so the limit now looks like connection capacity rather than CPU

That ties the merged #569 row (65,000) again, so this isn't merged (follow-ups are merged only when they beat the merged row). The leaderboard keeps the #569 row and the footnote now lists this run too.

The head moved to 36ba5f5 while this run was going. That commit is queued and gets its own run when its turn comes; I'll post the result here.

— benchmark agent

Two hardening items from the ladder-scale analysis:

1. GENERATION WRAP (latent correctness bug): next_generation was a
   16-bit wrapping counter — at 65,536 admits it wrapped, and a stale
   in-flight CQE could collide with a live connection's generation and
   be misrouted (wrong fd closed/written). arjay's 65k-user ladder run
   churned through the wrap window. uring-kit 0.1.4 widens the token
   generation field to 24 bits (16.7M admits per wrap; the 16-bit slot
   still fits fds exactly under NOFILE=65535).

2. fd-in-token routing: the token's (previously unused) slot now
   carries the connection fd — every CQE routes straight back to its
   connection with zero lookups. The gen->fd HashMap is gone (one
   hash per CQE saved), and the live-vs-graveyard decision is a
   single generation-checked conn lookup.

Also: the graveyard accounting now clears op_in_flight BEFORE
close_conn on error paths (the completing CQE IS the in-flight op —
the old order left pending_ops=1 forever, leaking graveyard entries
on every recv error).

test: 42/42 golden; uring-kit 43+8+1 tests; rig-verified.
arjaythedev added a commit that referenced this pull request Dec 3, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@arjaythedev

Copy link
Copy Markdown
Owner

Benchmarked at 36ba5f5 on the $12 box (1 vCPU / 2 GB, direct): 60,000 users held 5 min, 42/42 tests.

  • 5,898 req/s, p95 14.9 ms / p99 62.3 ms, 0 errors (2× 500 on POST /posts), 38 % CPU, 60 µs/request, 1,401 MB peak
  • 63,000 and 65,000 failed the 2-minute probe on tail latency (p99 1.09 s / 1.42 s, 0 errors) and 70,000 with 3.9 % connection resets
  • CPU per request dropped (83 → 60 µs), but p50 latency went from ~0.4 ms to ~7 ms at every load level, even 20,000 users, with occasional multi-second stalls. With CPU this low, it's probably waiting on something rather than computing (checkpoints or the new pragmas would be my first guess)

That's below the merged #569 row (65,000), so this isn't merged. The leaderboard keeps the #569 row and the footnote now lists this run too.

The head moved to 23b5654 while this run was going. That commit is queued and gets its own run next. I'll post the result here.

— benchmark agent

…arvation)

The side-thread checkpoint experiments both failed at 7% write
failures (16k VUs): a PASSIVE checkpoint folds wal frames but never
shrinks the WAL FILE — the file-size gate stayed open after the
first checkpoint and the thread checkpointed back-to-back every
200ms, holding the wal-index write lock against the writer's frame
appends. Likes (17% of traffic) starved; the write-gate coordination
flag didn't help because the gate itself was the bug.

Reverted to the verified-best policy: the native on-writer
autocheckpoint at 1000 pages (~4MB) — 0.69% errors at a 16k-VU hold,
WAL bounded, read latency stable. Its known cost: the checkpoint's
DB fsync runs on the event-loop thread (the ~0.7% feed timeouts,
under the 1% gate). The kensac-style off-loop checkpoint thread is
the documented next step, and it needs a lock-aware trigger (the
checkpoint result's log-pages count, not the file size).

test: 42/42 golden.
arjaythedev added a commit that referenced this pull request Dec 3, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@arjaythedev

Copy link
Copy Markdown
Owner

Benchmarked at 23b5654 on the $12 box (1 vCPU / 2 GB, direct): 60,000 users held 5 min, 42/42 tests.

  • 5,899 req/s, p95 14.4 ms / p99 70.2 ms, 0 errors (7× 500 on POST /posts), 36 % CPU, 57 µs/request, 1,401 MB peak
  • 63,000 and 65,000 failed the 2-minute probe on tail latency (p99 1.28 s / 2.01 s, 0 errors). It's GET /feed that stalls (p99 3.1 s / 4.9 s at those loads), while /posts/:id and the writes stay around 20 ms. 70,000 failed with 3.6 % connection resets
  • Almost the same as 36ba5f5: p50 is still ~7 ms at every load (it was ~0.4 ms at 1b6ea51) and CPU stays under 40 %, so whatever changed in 36ba5f5 is still making it wait rather than compute

That's below the merged #569 row (65,000), so this isn't merged. The leaderboard keeps the #569 row and the footnote now lists this run too. Also, the server returns occasional 500s on POST /posts in every run since 1b6ea51. They're too rare to fail a probe, but they're worth a look.

The head moved to 2eeac93 while this run was going. That commit is queued and gets its own run next. I'll post the result here.

— benchmark agent

arjaythedev added a commit that referenced this pull request Dec 3, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@arjaythedev

Copy link
Copy Markdown
Owner

Benchmarked at 2eeac93 on the $12 box (1 vCPU / 2 GB, direct): 60,000 users held 5 min, 42/42 tests.

  • 5,900 req/s, p95 14.3 ms / p99 59.3 ms, 0 errors (10× 500 on POST /posts), 36 % CPU, 57 µs/request, 1,410 MB peak
  • 63,000 and 65,000 failed the 2-minute probe on p99 (1.30 s / 2.35 s, almost all from GET /feed stalls; the other routes stay under ~23 ms) and 70,000 with 4.4 % connection resets
  • wal_autocheckpoint 1000 made about no difference vs 23b5654: p50 is still ~7 ms at every load with CPU at ~36 %, so the stall looks like something other than checkpoint size. 1b6ea51 (before the cache/mmap pragmas and cached write statements) had p50 under 1 ms on the same box

That's below the merged #569 row (65,000), so this isn't merged. The leaderboard keeps the #569 row and the footnote now lists this run too. Push a new commit and it gets queued for another run.

The 500s on POST /posts (a handful per run since 1b6ea51) might be worth a look too.

— benchmark agent

… = torn-page corruption

The bisect result: with mmap_size=1GB (the CL-013 perf change), the
native autocheckpoint's fold rewrote DB pages in place while mmap
readers served those same pages — the WRITER's own mmap'd copies went
torn mid-fold (its INSERTs failed with 'database disk image is
malformed', 7% of likes at 16k VUs) and the shim's mmap-backed
pcache entries served torn bytes to the cursors. Reproduced across
four consecutive runs; with mmap_size=0 on both connections and the
same everything else: 0.00% malformed, 0.109% errors at a 150s 16k
hold, post-hold integrity OK, likes exactly accounted.

The cost: page reads via pread+pcache instead of zero-copy mmap (the
rep_movs share returns, bounded by the pcache hit rate). Correctness
first; the latency delta on arjay's fast storage is the ladder's to
measure.

Also ships the LOOP_STATS instrument (queue depth, pass duration,
cycle rate per 5s) — the tool that caught the post-crash collapse
live (conns=15999, completions at 1-10/s, then k6 teardown).
The live profile at 16k VUs ranked the allocator at ~5.5% (_mi_page_
malloc_zero 3.3% + mi_free 1.3% + theap 0.6%): every feed allocated
a fresh 6KB body buffer per response, and every write completion
dropped it. The loop is single-threaded — a plain Vec free-list
(take_body / return_body around the outbox frame lifecycle) recycles
the buffers with zero locks. Bodies move into outbox frames as
before; the frame returns its buffer to the pool on write completion
(after the kernel is done with the bytes — the CQE marks completion).

test: 42/42 golden.
arjaythedev added a commit that referenced this pull request Dec 4, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@arjaythedev

Copy link
Copy Markdown
Owner

Benchmarked at c8e2b8d on the $12 box (1 vCPU / 2 GB, direct): 60,000 users held 5 min, 42/42 tests.

  • 5,877 req/s, p95 16.8 ms / p99 222.7 ms, 0.001 % errors (21× 500 on POST /posts), 40 % CPU, 63 µs/request, 1,445 MB peak
  • 63,000 and 65,000 failed the 2-minute probe on p99 (1.91 s / 4.07 s, again from GET /feed stalls; GET /posts/:id and the writes stay under ~31 ms p99) and 70,000 with 3.4 % connection resets
  • Turning the writer's mmap off and the body-buffer free-list didn't move it: p50 is still ~7–8 ms with CPU at ~40 %, same pattern as 36ba5f5…2eeac93. 1b6ea51 is still the last commit with p50 under 1 ms here

That's below the merged #569 row (65,000), so this isn't merged. The leaderboard keeps the #569 row and the footnote now lists this run too. Push a new commit and it gets queued for another run.

The 500s on POST /posts are still there (21 in the 5-minute hold).

— benchmark agent

…s fold era corrupted the DB

The rig evidence across this session: (1) with wal_autocheckpoint=1000
the WAL reached 30,993 pages without a single fold firing (a manual
PASSIVE checkpoint from an external connection folded all 30,993
cleanly, busy=0 — the mechanism works, the trigger never fired in our
usage); (2) the checkpoint-thread designs starved the writer (7%
like failures); (3) the corrupt-era runs left the seed.db file
corrupted (torn pages, cause unresolved — the VM hard-crash and the
checkpoint era are both suspects).

No checkpointing verified clean: 0.137% errors at a 150s 16k-VU
hold, integrity ok on six during-hold samples and post-hold, likes
exactly accounted. Cost: the WAL grows across a hold (reads pay
wal-index lookups over its frame set — med 1.3s / p95 7.2s on the
slow VM storage). The checkpoint redesign (off-loop, lock-aware
trigger) is documented in the ledger before it comes back.
…he pragma entirely — sqlite's default 1000 silently re-enabled the corrupting fold)
arjaythedev added a commit that referenced this pull request Dec 4, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@arjaythedev

Copy link
Copy Markdown
Owner

Benchmarked at bdd569f on the $12 box (1 vCPU / 2 GB, direct): 65,000 users held 5 min, 42/42 tests.

  • 6,399 req/s, p95 1.3 ms / p99 3.5 ms, 0 errors (5× 500 on POST /posts), 57 % CPU, 83 µs/request, 1,494 MB peak
  • 68,000 failed the 2-minute probe with 6.3 % connection resets and 70,000 with 10.2 % (EOF / reset on GET /feed), with CPU at ~57–61 %
  • Turning checkpointing off brought p50 back under 1 ms (0.4 ms), so the GET /feed stalls from 36ba5f5…c8e2b8d are gone. The ceiling is back to the connection resets seen at 1b6ea51

That ties the merged #569 row (65,000), so this isn't merged (a follow-up has to beat the merged row). The leaderboard keeps the #569 row and the footnote now lists this run too. Push a new commit and it gets queued for another run.

— benchmark agent

The checkpoint redesign, third attempt, informed by the two failures:

- CL-014b lesson 1 (unconditional thread): the checkpoint's copy
  phase holds the wal-index write lock and stalls the writer's frame
  appends.
- CL-014b lesson 2 (the file-size gate): a PASSIVE checkpoint folds
  frames but never shrinks the WAL FILE — the gate never closed.
- CL-013 lesson (the native autocheckpoint): its fold never fired at
  all (30,993 pages unfolded), and its fold-era DB writes raced the
  shim's mmap pages (mmap since removed).

The design that resolves all three: the shim's read txn CLOSES at
the pass boundary (end_pass — new ShimReader split), the WRITER runs
PRAGMA wal_checkpoint(TRUNCATE) in that reader-free window when the
WAL file exceeds 16MB (stat — no DB locks; TRUNCATE always succeeds
with no readers and resets the file to zero), then the shim's read
txn + cursors reopen. The WAL stays bounded at ~16MB + one pass,
the wal-index stays small (fast reads), the fold is sqlite-native
from the writer connection, and no reader can observe a torn page
(no reader txn is open during the checkpoint).

test: 42/42 golden.
…es the torn-read hazard structurally

The mmap=0 bisect cost the read path ~500x at the median on the slow
VM storage (med 2.7-6.7ms with mmap vs ~1,300ms without — every
scattered page read became a storage pread). The torn-read hazard
that forced the bisect is eliminated STRUCTURALLY by the reader-free
checkpoint window (the previous commit): checkpoints run only when
this connection's read txn is closed, so the mmap can never observe
a fold mid-read-txn. The writer's mmap stays 0 (its fold writes must
not tear its own pcache — CL-015).
The two failed designs (CL-014b) + the never-firing native
autocheckpoint all triangulated to this design:

- TRUNCATE every 2s from a side connection: the fold copies only up
  to the oldest reader mark (the shim's per-pass txn advances it
  every cycle), so each checkpoint copies ~2s of writes (~1-2MB,
  ~ms) and the WAL FILE resets to zero on success — bounded, and
  the stat-gate trap from v2 (PASSIVE never shrinks the file) is
  gone because TRUNCATE does.
- busy_timeout 0: if the loop holds locks, the checkpoint SKIPS
  (never stalls the loop — the v1 failure).
- The TRUNCATE only completes between passes (no reader txn open),
  so no reader can observe a torn fold.

The corruption chain this closes: the never-firing native
autocheckpoint let the WAL reach 30,993 pages; the fold-era DB
writes raced the shim's mmap pages (torn reads -> 'malformed' ->
SQLITE_CORRUPT on the writer's inserts); the vm hard-crash then
mid-checkpoint sealed a torn page-1 into the file.

test: 42/42 golden.
arjaythedev added a commit that referenced this pull request Dec 4, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@arjaythedev

Copy link
Copy Markdown
Owner

Benchmarked at 306f4f0 on the $12 box (1 vCPU / 2 GB, direct): 65,000 users held 5 min, 42/42 tests.

  • 6,392 req/s, p95 100.5 ms / p99 207.7 ms, 0.041 % errors (949× 500 on POST /posts), 56 % CPU, 81 µs/request, 405 MB peak
  • 68,000 failed the 2-minute probe with 6.4 % connection resets and 70,000 with 10.1 %, with CPU at ~65–73 %
  • Compared with bdd569f, p95/p99 went from 1.3 / 3.5 ms to ~100 / 208 ms, and the POST /posts 500s went from 5 to 949 in the hold. The TRUNCATE window seems to stall the loop or the writer at times. Memory peak dropped from 1,494 MB to 405 MB

That ties the merged #569 row (65,000), so this isn't merged (a follow-up has to beat the merged row). The leaderboard keeps the #569 row and the footnote now lists this run too.

The head moved to 9d54994 (checkpoint thread v3) while this was running. It's queued and starts next.

— benchmark agent

arjaythedev added a commit that referenced this pull request Dec 4, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@arjaythedev

Copy link
Copy Markdown
Owner

Benchmarked at 9d54994 on the $12 box (1 vCPU / 2 GB, direct): 65,000 users held 5 min, 42/42 tests.

  • 6,395 req/s, p95 63.6 ms / p99 158.8 ms, 0.086 % errors (1,985× 500 on POST /posts/:id/like and POST /posts), 57 % CPU, 83 µs/request, 411 MB peak
  • 68,000 failed the 2-minute probe with 6.4 % connection resets and 70,000 with 10.2 %, with CPU at ~68–72 %
  • Compared with 306f4f0, p95/p99 improved (100.5 / 207.7 → 63.6 / 158.8 ms), but the 500s on writes went up (949 → 1,985 in the hold). bdd569f had p95/p99 1.3 / 3.5 ms with 5 errors, so the checkpoint thread still seems to make writes hit SQLITE_BUSY (busy_timeout 0?) and stall the loop now and then

That ties the merged #569 row (65,000) again, so this isn't merged (a follow-up has to beat the merged row). The leaderboard keeps the #569 row and the footnote now lists this run too. The ceiling still looks like the connection resets at ~68k with CPU well below 100 %, rather than the checkpointing.

— benchmark agent

amanica pushed a commit to amanica/twelve-dollar-server-challenge that referenced this pull request Dec 4, 2026
…low arjaythedev#569)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
amanica pushed a commit to amanica/twelve-dollar-server-challenge that referenced this pull request Dec 4, 2026
arjaythedev#569)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants