HeadlinesBriefing favicon HeadlinesBriefing.com

Igropyr: Fault-Tolerant Chez Scheme Web Server

Hacker News •
×

Igropyr delivers a Chez Scheme web server built on libuv that treats faults as protocol rather than failure. Every request runs in a supervised worker pool — handlers crash freely, and the supervisor replaces workers instantly, retrying tasks up to three times before the client sees an error. A CPU-spinning handler stuck beyond 30 seconds is killed preemptively; other connections never notice. This Erlang-style actors model runs thousands of green processes on one OS thread with pure message passing and no locks.

Hot code swapping lets developers replace individual routes or the entire handler on a live server. The listener, open connections, and worker pool stay up while in-flight requests finish on old code. Combined with graceful shutdown and SO_REUSEPORT multi-process listening, zero-downtime deployment becomes default behavior. The remote retry ring goes further: when retries exhaust or a stuck worker dies, an optional on-failure hook returns structured JSON faults ("crash" or "stuck") over the same keep-alive connection, letting clients resubmit with changed parameters or carried state.

Multi-request dialogues — wizards, bookings, transfers — run as single green processes holding live state across rounds, including open database transactions. The suspend!/resume! mechanism parks continuations at exact code lines; death from any cause guarantees rollback, and a later resume receives 'gone, proving nothing committed. Benchmarks show 120k+ req/s with keep-alive on a laptop, zero failed requests under ab -c 500, and full recovery from a stuck pool in ≤35s.

Igropyr proves that hot code swapping and actor-style fault tolerance need not require a BEAM runtime. By compiling the entire framework and application into one optimized binary via Chez's whole-program compilation, it eliminates the C-shim layer common in other Scheme web stacks. The included OTP building blocks (gen-server, registry, Pub/Sub), WebSocket support, streaming responses, and S-expression RPC make it a complete platform for building resilient, stateful web services in pure Scheme.