Repository navigation
v0.5.0
Operational core
Request.peer: SocketAddr+Peerextractor; the kernel's view of the connecting peer threaded onto every parsed request.- Sanitised 4xx / 5xx response bodies (parse-error messages logged with request id, never echoed). Local-dev opt-out via
ServerConfig.expose_error_messages = True. Canceltoken (peer FIN, timeout, drain unified through one cell).CancelHandlertrait +WithCancel[H]adapter for handlers that opt into cooperative polling.- Per-request deadlines:
read_body_timeout_msenforced end-to-end on the cancel-aware reactor read path;handler_timeout_msandrequest_timeout_msconfigured + asserted at construction. HttpServer.drain(timeout_ms) -> ShutdownReporton the single-threaded reactor; multi-workerScheduler.drainreturns oneShutdownReportper worker.
Buffer ownership + streaming
RouteracceptsHandlerstructs (not justdeffunctions).- Concrete extractors (
PathInt/PathStr/PathFloat/PathBool+ Query / Header / Optional variants) —.valueis the parsed primitive directly. HeaderMapView[origin]zero-copy header storage on the read path; RFC 7230 § 3.2.4 / § 3.2.6 token + field-value validation at parse time.Pool[T]typed allocator (replaces the_Boxed[H]pad after publicsize_of[T]()).RequestView[origin]zero-copy request reads on the cancel-aware reactor;ViewHandlertrait +HttpServer.serve_view[VH]entry point.- Streaming bodies:
Body/ChunkSourcetraits,InlineBody,ChunkedBody[Source],StreamingResponse[B: Body]sibling type, RFC 7230 chunked serializer with lowercase hex chunk-size lines. - Cross-thread
Cancel.SHUTDOWNflip via worker-self-walks-conns (no shared-state mutex).
Server-side TLS
TlsAcceptor+TlsServerConfig+TlsInfo. ALPN selection callback, mTLS opt-in with construction-time validation, cert reload without restart (acceptor.reload()), blocking-pollhandshake_fd(fd)entry point.Request.tls_info: Optional[TlsInfo]populated from the live handshake.- Server-side OpenSSL FFI surface: nine
flare_ssl_*C exports coveringSSL_CTX_new_server,SSL_accept, peer-cert / cipher / version / ALPN getters,ctx_reload,set_verify_client_cert.
Blocking-escape hatch
block_in_pool[T](work, cancel) raises -> Truns blocking syscalls on a fresh kernel thread (per-callpthread_create+pthread_join). Cancel contract: pre-flight + post-flight checks; user code pollscancelinsidework()for mid-flight short-circuit. Crash isolation: a segfault inwork()kills its own pthread, not the reactor's.
Bench + soak
- Bench harness fully on
wrk2(CO-corrected), two-phase (find-peak then sustain at 90 % of peak). Per-run--latencydistribution: p50 / p75 / p90 / p99 / p99.9 / p99.99 / p99.999. - Five workloads ship:
micro-static,mixed_keepalive,uploads,downloads,slow_clients,churn. - Soak harness (
bench-soak-*): three-tier slow-client / churn / mixed-load. Smoke (60 s/workload), extended (5 min/workload), 24 h release-gate viaSOAK_DURATION_SECS=86400. Per-workload gates: zero non-2xx,rss_end <= 2 * rss_start,fd_end <= fd_start + 16.
Numbers (Linux EPYC 7R32, single-worker, plaintext)
- ~80K req/s, on par with
nginx (worker_processes 1), ~1.96×Go net/http (GOMAXPROCS=1). flare_mc4 pinned workers: 4.38× the single-thread reactor (near-linearSO_REUSEPORTscaling).- Tail at sustained 90 %-of-peak load: p50 ~ 1.2 ms, p99 ~ 3.1 ms, p99.99 ~ 3.8 ms.
Compatibility & infra
mojo == 0.26.3.0.dev2026042005pinned acrosspixi.toml+recipe.yaml.jsondep bumped tov0.1.4; OpenSSL pinned at major 3.- CI Linux runners pinned to
ubuntu-22.04(Mojo runtime crash insidelibKGENCompilerRTShared.soonubuntu-latest/ 24.04 — works around a documented glibc-2.39 ABI break). - CI generates the self-signed cert before
pixi run tests(TLS test cert paths are repo-relativebuild/tls-bench-certs/).
Docs
- README leads with
## Features+## Numbers(full-library framing, not v0.5-changelog). docs/benchmark.mdcarries methodology + single-worker / multi-worker discipline (no apples-to-oranges multi-vs-single ratios) + soak harness as## Soak: long-running operational gates.docs/cookbook.md,docs/architecture.md,docs/security.mdupdated.- Public docs are version-agnostic across the board.
Mojo-blocked, deferred to the v0.5.x patch line (do NOT block this tag)
install_drain_on_sigterm/install_sigterm_handler— Mojo "global variables are not supported"; production deployments wire their ownsignal(2)handler today (seeexamples/23_drain.mojo).- Reactor-state-machine TLS handshake (
STATE_TLS_HANDSHAKEadvanced viaon_readable/on_writable) — gated on parametric trait method specialisation cost in a future Mojo nightly. Blocking-pollhandshake_fdships today. - Reactor pull-edge for
StreamingResponse[B]— same parametric-trait specialisation block. Streaming serializer + handler-driven chunked body ship today; reactor-driven pull-loop integration is the follow-up.