system design
Zlay discovers PDS hosts from a bootstrap relay and crawls each PDS directly. Readers perform framing and admission work, then a bounded shared frame-processing pool performs decoding, validation, metadata work, collection indexing, event persistence and downstream delivery. Network input, queued processing and consumer output each have independent backpressure; an index microbenchmark does not establish relay capacity.
I/O and execution
The relay targets Zig’s std.Io. The default backend is Io.Threaded; deployments use lalinsky’s zio with -Dbackend=zio. Zio schedules cooperative tasks over executor threads, so CPU-bound work and long critical sections can delay unrelated tasks. Some database and maintenance work runs through dedicated owners or threaded I/O. A successful default build does not analyze every zio-specific path: validate both backends.
validation and authority
Signing-key cache hits permit commit signature verification. A cache miss can pass optimistically while background resolution obtains the key; it is not strict synchronous verification of every first-seen account. Host authority checks, DID resolution and PostgreSQL work are separate from the collection index. Cold discovery and resolver limits can dominate a fresh relay’s backlog.
storage boundaries
PostgreSQL stores relay/account/host metadata. The collection index uses zkv with two ordered namespaces for repo-to-collection and collection-to-repo lookups, applying corresponding changes atomically. Caller-owned batching, page reads and maintenance coordinate access. Grouped table compression is opt-in; legacy encoding remains the default.
The event log stores sequenced frames for replay, independently of the collection index. Retention and replay settings govern that history; disabling disk replay does not remove index or metadata work. A received event, a completed index commit, and a recoverable event-log record are different observations.
Event-log flush completes positional writes and advances a visibility watermark, but does not issue an fsync barrier. Process-kill restart tests exercise recovery with the host and its caches alive; they do not establish power-loss durability. Do not describe that watermark or end-to-end benchmark completion as durable event acknowledgment.
downstream delivery
Consumers receive queued frames through independent writers. The current idle consumer writer polls every 100 ms. Offline tracing found a shared delivery-latency contribution here across both storage engines. Notification prototypes improved medians but increased measured CPU use and some tails; those prototypes were not promoted into main.
operations and evidence
Use configuration and deployment for operating guidance. The measurement overview distinguishes equal-input storage comparisons from live arrival windows and full-relay qualification. Historical design notes preserve earlier implementation details and projections without treating them as current guarantees.