Skip to content

perf(sut): add bounded asynchronous HTTP I/O - #281

Closed
MisterVVP wants to merge 2 commits into
mainfrom
perf/277-async-http
Closed

MisterVVP wants to merge 2 commits into
mainfrom
perf/277-async-http

Conversation

@MisterVVP

@MisterVVP MisterVVP commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

Summary

The performance SUT currently uses blocking HTTP sockets, a thread per connection, and a polling accept loop. This change selects a standalone-Asio implementation with one I/O loop, four fixed application workers, bounded connection/input/output admission, and resumable HTTP+JSON/JSON-RPC streaming. The TCK SUT continues selecting its existing blocking server.

The shared incremental parser and response encoder preserve blocking callers. Readiness callbacks, bounded subscriber queues, serialized cleanup, and a reset admission barrier preserve stream reuse, cancellation, shutdown, and diagnostic counter meaning. Native CI exercises the new socket suite on Linux/macOS/Windows, with HTTP-only coverage in the sanitizer jobs.

Normal response closure sends FIN before draining the receive side, with a two-second deadline and immediate cancellation on server shutdown. This fixes Winsock resets when closing canceled a pending receive. New regressions require complete unary/finite responses followed by clean EOF, cover unread pipelines, and prove that close deadlines release bounded admission.

Closes #277 when the remaining performance acceptance gap is resolved. This PR is draft because the longer comparison confirms a low-concurrency finite-SSE throughput regression.

Performance evidence

Architecture and benchmark evidence include reproduction commands, raw before/after samples, hardware/build/store settings, fixed tolerances, and CPU/RSS/thread measurements.

  • Zero errors across all measured workloads and the required smoke.
  • Four application workers plus one I/O thread remain fixed. Actual server threads, including gRPC, remain roughly 13 even with 128 idle connections; the baseline grows with connections/churn.
  • Connection churn throughput improves 193%/73% at one client and 11%/32% at 64 clients (in-memory/PostgreSQL). High-concurrency in-memory finite SSE improves 30% in the short matrix.
  • Fourteen of twenty 2-second comparisons meet the predeclared tolerances. All six outliers received five alternating 10-second repetitions, without relaxing the thresholds; five follow-ups meet the limits.
  • Outstanding: in-memory finite SSE at concurrency one measures 2,904 → 2,468 ops/s (-15.0%), exceeding the 10% throughput-loss limit. Its p95/p99 remain within the latency limits. This must be investigated before claiming the issue's no-material-regression acceptance criterion. The draft retains every short-run outlier and all longer samples.

Authorship and AI usage

  • Contains substantive content written by a human
  • Contains substantive content generated by an AI agent

Implementation, tests, configuration, documentation, and measurements were produced by OpenAI Codex under maintainer direction.

Testing

  • Windows follow-up: the unread-pipeline regression fails with a connection reset on the original binary and passes with the repair. ASan/UBSan passes both HTTP drivers and persistence tests; TSan passes the HTTP-only suite. Native Windows compilation and tests pass in CI run 38084238374.
  • Exact CI clang-format --dry-run --Werror mechanism, ./scripts/verify_changes.sh, and separate ./scripts/run_clang_tidy.sh build: exit 0. Native Debug build has PostgreSQL and subscription diagnostics enabled; all 671 tests pass.
  • Required gRPC/HTTP+JSON in-memory performance smoke: 54 rows, zero errors.
  • ASan/UBSan with leak detection: 59 focused parser/subscription/socket tests pass. TSan: 58 focused tests pass without suppressions. Each HTTP driver runs eleven socket cases, including fragmented input, forced partial writes, pipeline/backpressure, idle/slow clients, finite/live streaming, real heartbeat delivery, cancellation/reuse, accept resumption, and shutdown.
  • TSan's HTTP-only driver uses the same asynchronous runtime with gRPC startup disabled. The combined SUT reports a race in uninstrumented system Abseil graphcycles during gRPC startup; the isolation avoids masking it with a suppression.
  • Cppcheck warning/portability scan passes. Added Asio dependency reviewed against GitHub's advisory database; required 1.18+ and tested 1.28.1 are outside CVE-2019-25219's affected range. The environment proxy blocks OSV API access, so a complete transitive vulnerability audit is not claimed.

The requester explicitly waived the existing 80.9% TCK compliance gate. A full TCK run is not claimed; blocking SUT selection and binary diagnostic-symbol isolation are covered by native regressions. Native Linux and macOS CI jobs pass. Windows MSVC compilation and the native test step also pass in the linked follow-up run.

Local lint runs the real clang-tidy 19 executable in parallel and reuses successful checks only when compiler commands, configuration, source, and dependency headers are identical.

Checklist

  • ./scripts/verify_changes.sh passed locally
  • Docs updated if behavior changed

Select standalone Asio for the performance SUT while preserving the blocking
TCK server. Add bounded incremental I/O, stream readiness and cancellation,
diagnostic reset coordination, socket regressions and benchmark evidence.

AI-generated implementation under maintainer direction. Low-concurrency
finite-SSE throughput remains outside the published tolerance; submit as draft.
@MisterVVP MisterVVP added the AI agent AI agent contribution label Oct 10, 2026 — with ChatGPT Codex Connector
@MisterVVP MisterVVP self-assigned this Oct 10, 2026
Send FIN before draining pending receive operations, bounded by a two-second
close deadline. Keep admission charged until cleanup and cancel draining on
server shutdown. Require complete unary/finite replies and clean EOF in socket
regressions; cover unread pipelines and deadline-based admission release.
@MisterVVP MisterVVP closed this Oct 11, 2026
@MisterVVP
MisterVVP deleted the perf/277-async-http branch October 11, 2026 09:24
@MisterVVP

Copy link
Copy Markdown
Owner Author

This change is larger than intended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI agent AI agent contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant