Zero 1.8
Observability and Reliability
Installation
npm install @rocicorp/zero@1.8Overview
Zero 1.8 improves operational observability, self-hosting options, API visibility, and replication reliability.
Features
- Request-header forwarding:
zero-cachecan now forward selected incoming request headers, such as proxy or load-balancer headers, to custom mutate and query APIs viaZERO_MUTATE_ALLOWED_REQUEST_HEADERSandZERO_QUERY_ALLOWED_REQUEST_HEADERS. (#6144, thanks @tjenkinson!) - GHCR Docker images: The Zero Docker image is now published to
ghcr.io/rocicorp/zeroin addition to Docker Hub. (#6161) - API-server and startup metrics:
zero-cachenow exports request, attempt, duration, and in-flight metrics for calls to user API servers, plus startup-duration metrics for zero-cache and worker readiness. (#6203, #6208) - Initial-sync metrics:
zero-cachenow exports initial-sync metrics for run outcomes, COPY time, SQLite flush time, index creation time, copied rows, copied bytes, and COPY chunks. (#6191) - Litestream backup and restore metrics:
zero-cachenow exports metrics for Litestream restore runs, restore attempts, restore validation, restored DB size, backup subprocesses, backup listing, backup verification, and snapshot reservations. (#6199) - Replication slot metrics:
zero-cachenow exports health and WAL-retention metrics for the active Postgres logical replication slot. (#6210) - Serving-lag metrics:
zero-cachenow exports metrics for replica changes that are ready locally but have not yet been fully served to active client groups, including aggregable native histograms for view-syncer lag and hydration. (#6157, #6214, thanks @tantaman!) - Stability metrics:
zero-cachenow exports CVR load/flush, client WebSocket connection, and replication flow-control/backlog metrics for debugging reconnects, transport churn, and downstream backpressure. (#6207, thanks @tantaman!)
Performance
Zero 1.8 includes targeted improvements for common in-memory ZQL fetches, ordered take maintenance, and CDC changeLog persistence.
The results below compare Zero 1.7 (6863de5f00a3c1e7dc09c83ea3263dec4a94ebee) to Zero 1.8 (4ef9e4ef04fbc9fa838c930887d5d6b97241b789) using 10 separate process-level runs per ref. Values are median-of-medians from the benchmark output, normalized so higher is better.
In-Memory ZQL Fetch
Common in-memory ZQL fetches are faster when there is no active overlay, start cursor, or connection filter. In the measured fetch hot paths, Zero 1.8 is about 2.05x faster by geometric mean. (#6127)
In-Memory ZQL Fetch
Normalized fetch throughput. Higher is better.
Ordered take Maintenance
Ordered take maintenance fetches can now add a redundant leading-column bound for non-nullable leading sort columns, letting SQLite seek into the relevant index range instead of scanning a large partition. In a targeted benchmark with a 100k-row partition and a start cursor near the end, the median fetch time improved from 2.64 ms to 501 ns. (#6184, thanks @tantaman!)
Ordered Take Maintenance
Normalized fetch throughput for a targeted 100k-row SQLite partition benchmark. Higher is better.
CDC Storer Throughput
zero-cache now batches CDC changeLog writes into multi-row inserts, reducing the time spent persisting metadata for large upstream transactions. In the targeted PostgreSQL storer benchmark, Zero 1.8 is about 1.7x faster by geometric mean. (#6142)
CDC Storer Throughput
Normalized payload throughput while persisting replication changes to the change log. Higher is better.
Fixes
- Logical replication could stall indefinitely when the inbound Postgres replication stream went silent instead of reconnecting. (thanks @tantaman!)
- Postgres connections could crash after a socket disconnected while a pending write still tried to use the closed socket.
- Drizzle 1.0 RC
prepareQueryresults could come back in array mode instead of object mode, breaking Zero's Drizzle adapter. (thanks @typedrat!) - z2s failed to compile queries using
start, and SQLite fetches could handlenullstart cursor fields incorrectly. (thanks @tantaman!) - Queries could appear
completewith stale or empty results after reconnect when persistedgotstate was no longer authoritative. - React Native reads using
op-sqlitev17 could crash withiterator method is not callable. - View-syncer pods could exit with
max attempts exceeded restoring replicawhile the first backup was still uploading. - Cold-start view-syncers could be told to restore before a restorable backup existed, causing repeated failed restore attempts.
- Zero Docker images used a Node build affected by the
availableParallelismbug. (thanks @tantaman!) - Catching-up change-stream subscribers could bypass flow control and build an unbounded in-memory backlog. (thanks @tantaman!)
Breaking Changes
None.