Optimize C++ hot reads and durable bulk writes; fix HTTP backpressure #33

Merged
pxc1984 merged 7 commits from hotcaller/posvyat-challenge:submission/cpp-epoll-hotcaller into master 2026-11-07 22:19:11 +00:00
Member

Moves common LMS reads and mutation calculation out of PostgreSQL into an authorized resident projection. Independent writes share bounded array statements, while per-pair ordering, immutable retries and commit-only publication preserve durability. Interned values own one stable copy, and repeat lookups avoid temporary allocations. HTTP preserves queued requests after a client write-half-close, completes partial empty-response headers, and resumes input after blocked 100 Continue output.

Resident state and transport were informed by the two C revisions, actual sequence reservations and input draining by Rust, and grouped cold reads by Zig. These are independent C++ implementations; OPTIMIZATION.md records all pinned sources and differences. The resident projection assumes this application is the only writer while running; external database changes require restart.

Validation: final v20 x86-64 under 512 MiB and ARM64 ASan/UBSan under 1 GiB both pass organizer 137/137 and extended conformance 54/54. The sanitizer also passes all six real bulk SQL forms across 32 pairs, with no diagnostics or OOM and a 853.36 MiB peak. Normal and sanitizer transport fixtures pass eight half-close cases; projection checks cover interned-value ownership, 12,000-value growth, moves and reload. Earlier v16 native and durability/restart checks also passed. The 512 MiB runtime passed with memory-limit pressure and no OOM; the earlier 512 MiB sanitizer failure is retained in VALIDATION.md alongside exact revisions, configurations and matching source hashes.

Defaults are bulk writes on, named statements off and JSON writev. Fresh named pipelines reproducibly corrupted responses through local PgBouncer 1.25.2 over TLS; identical direct-PostgreSQL and unnamed-pooler controls passed. This supports the default choice without proving the exact defect or the organizer's pooler version.

The v19 600,000-user five-minute hold failed: 64,618.4 requests/s, p95 5,232.64 ms and p99 6,834.18 ms, with 728.77 MiB peak total cgroup memory and no OOM. Its final 15 seconds included diagnostic profiling; latency had already failed before profiling. The earlier v18 60-second probe passed with p95 59.41 ms, but does not establish sustained capacity. These native ARM64 runs used approximately 34 ms database RTT. No official score, victory over the historical 832,000-user result, or million-user capacity is claimed.

Moves common LMS reads and mutation calculation out of PostgreSQL into an authorized resident projection. Independent writes share bounded array statements, while per-pair ordering, immutable retries and commit-only publication preserve durability. Interned values own one stable copy, and repeat lookups avoid temporary allocations. HTTP preserves queued requests after a client write-half-close, completes partial empty-response headers, and resumes input after blocked `100 Continue` output. Resident state and transport were informed by [the two C revisions](https://git.cu3rd.ru/cu3rd/posvyat-challenge/src/commit/13c57442f0c0fb65688836cac4c214762bee7d49/submissions/c-epoll-balbesik/src), actual sequence reservations and input draining by [Rust](https://git.cu3rd.ru/Mr-Jeany/posvyat-challenge/src/commit/38096973c058a10a68236ff1456d5e0266deaa47/submissions/rust-epoll-jeany/src), and grouped cold reads by [Zig](https://git.cu3rd.ru/pxc1984/posvyat-challenge/src/commit/8bdd0e9e5a8be24e730ac8865b26dce4ca6df4db/submissions/zig-zoi-pxc1984/src). These are independent C++ implementations; `OPTIMIZATION.md` records all pinned sources and differences. The resident projection assumes this application is the only writer while running; external database changes require restart. Validation: final v20 x86-64 under 512 MiB and ARM64 ASan/UBSan under 1 GiB both pass organizer 137/137 and extended conformance 54/54. The sanitizer also passes all six real bulk SQL forms across 32 pairs, with no diagnostics or OOM and a 853.36 MiB peak. Normal and sanitizer transport fixtures pass eight half-close cases; projection checks cover interned-value ownership, 12,000-value growth, moves and reload. Earlier v16 native and durability/restart checks also passed. The 512 MiB runtime passed with memory-limit pressure and no OOM; the earlier 512 MiB sanitizer failure is retained in `VALIDATION.md` alongside exact revisions, configurations and matching source hashes. Defaults are bulk writes on, named statements off and JSON `writev`. Fresh named pipelines reproducibly corrupted responses through local PgBouncer 1.25.2 over TLS; identical direct-PostgreSQL and unnamed-pooler controls passed. This supports the default choice without proving the exact defect or the organizer's pooler version. The v19 600,000-user five-minute hold failed: 64,618.4 requests/s, p95 5,232.64 ms and p99 6,834.18 ms, with 728.77 MiB peak total cgroup memory and no OOM. Its final 15 seconds included diagnostic profiling; latency had already failed before profiling. The earlier v18 60-second probe passed with p95 59.41 ms, but does not establish sustained capacity. These native ARM64 runs used approximately 34 ms database RTT. No official score, victory over the historical 832,000-user result, or million-user capacity is claimed.
Document current competition harness and memory metric
Some checks failed
challenge / find (pull_request_target) Successful in 2s
challenge / run (submissions/cpp-epoll-hotcaller) (pull_request_target) Has been cancelled
e99f7bc0dd
pxc1984 force-pushed submission/cpp-epoll-hotcaller from e99f7bc0dd
Some checks failed
challenge / find (pull_request_target) Successful in 2s
challenge / run (submissions/cpp-epoll-hotcaller) (pull_request_target) Has been cancelled
to 8968d41da2
All checks were successful
challenge / find (pull_request_target) Successful in 1s
challenge / run (submissions/cpp-epoll-hotcaller) (pull_request_target) Successful in 24m29s
2026-11-03 11:13:54 +00:00
Compare
pxc1984 force-pushed submission/cpp-epoll-hotcaller from 8968d41da2
All checks were successful
challenge / find (pull_request_target) Successful in 1s
challenge / run (submissions/cpp-epoll-hotcaller) (pull_request_target) Successful in 24m29s
to c34e5eb534
All checks were successful
challenge / find (pull_request_target) Successful in 1s
challenge / run (submissions/cpp-epoll-hotcaller) (pull_request_target) Successful in 36m40s
2026-11-03 12:00:24 +00:00
Compare
Reuse PostgreSQL plans with typed request parameters
Some checks failed
challenge / find (pull_request_target) Has been cancelled
f493a99427
Optimize committed projections, durable bulk writes and HTTP transport
All checks were successful
challenge / find (pull_request_target) Successful in 2s
challenge / run (submissions/cpp-epoll-hotcaller) (pull_request_target) Successful in 20m11s
84c3158d9b
hotcaller changed title from Add C++20 epoll/libpq submission for hotcaller to Optimize C++ hot reads and durable bulk writes; fix HTTP backpressure 2026-11-03 16:24:57 +00:00
Owner

у тебя в ридми буквально есть раздел где ты описываешь какие идеи откуда брал

у тебя в ридми буквально есть раздел где ты описываешь какие идеи откуда брал
pxc1984 merged commit 388e1b2415 into master 2026-11-07 22:19:11 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
cu3rd/posvyat-challenge!33
No description provided.