Zero 1.8

Observability and Reliability

Installation

npm install @rocicorp/zero@1.8

You can now use zero-cache from GHCR:

docker pull rocicorp/zero:1.8.0
# or
docker pull ghcr.io/rocicorp/zero:1.8.0

Overview

Zero 1.8 improves observability, performance, and reliability.

Features

Performance

Zero 1.8 speeds up replication of large transactions, maintenance of queries that use limit(), and client-side query hydration.

Replicating Large Transactions

Bulk imports, backfills, or migrations often change thousands of rows in a single Postgres transaction. These large transactions replicate about 1.5x faster in Zero 1.8.

Replicating Large Transactions

Measured on M5 Pro. Higher is better.

Maintaining limit() Queries

Consider a query like this:

zql.issue
  .where('status', 'open')
  .orderBy('created', 'asc')
  .limit(50)

Zero can fulfill this query using an index on either status or created. If it decides to use the created index, Zero might have to consider many rows before it finds 50 matches. That is unavoidable.

But when changes to the data move rows in or out of the first 50 results, Zero 1.7 repeated the work to find the first 50 results, making incremental updates slower than necessary. Zero 1.8 fixes this.

In benchmarks, when the last returned row was 50,000 rows into the index, incremental updates were 2x faster in Zero 1.8. When it was 100,000 rows in, updates were over 50x faster in Zero 1.8.

Maintaining limit() Queries

Measured on M5 Pro. Higher is better.

Client-Side Hydration

Zero runs queries first on the client, then on the server. The initial client-side hydration got faster in Zero 1.8. For example, this query returns initial data from client about 1.3x faster in Zero 1.8:

zql.issue.related('creator').related('comments')

Client-Side Hydration

Measured on M5 Pro. Lower is better.

Fixes

Breaking Changes

None.