Ship and scale
Chapter 10 of 11
Scale and the chaos lab
Branches, replicas and shards scale one schema behind one address. Database branches verify every migration ahead of main, and automated fault campaigns prove durability and failover in public.
Teams scaling a backend often test migrations against staging mocks and trust failover plans that have never been tested under load.
Try it
Create an isolated database branch and push a schema change without touching production.
Branches#
Pillar at work: Compiled
Every branch is an independent database beside main with separate records, keys and sessions. Each developer works on a personal branch locally while pull request CI spins up pr-12 to review migrations and check saved queries. Before a major launch, your team can run a release rehearsal on a branch cloned from the live records in main.
Isolated branch databases
Each branch (dev-ada, pr-12, rehearsal) runs beside main with separate records, service keys and session signing keys.
Query-checked branch pushes
napalm schema push --branch validates every file in dbschema/queries against the branch schema before touching main.
Every push checks your saved queries against the branch’s schema first, so broken queries fail on the branch long before reaching main.
Shards#
Pillar at work: Distributed from links
Once hundreds of customer companies outgrow one primary server, the Organization root links from Organizations and billing allow Napalm to spread companies across shards without changing your schema or queries.
napalm placement enable notesnapalm placement keep notes <organization-id> --region iadnapalm placement restore-root notes <organization-id> --to 2026-11-10T17:20:00ZRoot-mapped shard bays
Tenant graphs map to primary-replica shards by root ownership behind one project URL, and moving an Organization pauses its writes for only a few seconds at cutover.
Every record owned by one organization stays together on one shard. Moving a busy organization happens behind the same project address without changing your queries. Reads continue without interruption while writes for the moving organization pause for a few seconds.
The branch-wide change log runs only on single-shard branches today.
Engines and replicas#
Pillar at work: Commit-atomic
Stateless engines compile and route queries in front of your shards, and each replicated shard runs a primary and replicas across availability zones. Confirmed writes save to both the primary and a replica in the same region before returning. If no replica answers for 5 seconds, the primary commits alone until a replica returns.
napalm clusters scale <cluster> --engines 4 --replicas 2Stateless compiler engines
Compile EdgeQL and touched policies into single SQL statements, scaling connections and SSE streams without moving data.
Causal replica routing
Replicas confirm synchronous commits, serve reads caught up to Napalm-Bookmark and promote automatically if a primary stops answering.
Generated clients pass an opaque Napalm-Bookmark header automatically so read queries route only to replicas caught up to the caller’s own writes. When a primary stops answering for 30 seconds, a replica takes over behind the same address.
Fault campaigns and promises#
Every Napalm release runs an automated fault campaign before rollout, and nightly campaigns test the live release again. Every run appears on the public chaos lab.
Public fault-campaign verdicts
Release and nightly chaos campaigns inject crashes, zone splits and full disks into fresh clusters, and mark incomplete evidence Inconclusive rather than Passed.
| Group | Promise verified |
|---|---|
| Writes | Promise verifiedAcknowledged writes survive server crashes, freezes and full disks. |
| Replicas | Promise verifiedA replica takes over when a primary fails. Two primaries never write at once. |
| Change log and webhooks | Promise verifiedAcknowledged writes reach the change log and signed webhooks in commit order. |
| Presence | Promise verifiedRoom members keep their places when an engine crashes. |
| Shards | Promise verifiedA cross-shard write commits on both shards or on neither shard. |
| Access | Promise verifiedRevoked credentials read zero rows even on a lagging replica. Tenants never see another tenant’s rows. |
| Load | Promise verifiedExpensive read queries never starve concurrent writes. |
Inside a run and public verdicts#
Pillar at work: Checked and fault-tested
Each scenario builds fresh clusters from the release under test while clients send continuous reads and writes and record every acknowledged write. Halfway through the workload, the run injects one bounded fault, such as a database server crash, a frozen server, a dropped cross-zone network link, or a full disk. Once the fault ends, the run reads back every acknowledged write and checks every access rule.
Scenario Broken canopy · 2026.11.6Fault A replica drops off the network for 10 seconds while clients write.Verdict Passed Promises ✓ The primary keeps taking writes. ✓ The cut-off replica refuses a write. ✓ The replica catches up once the network returns. Evidence Acknowledged writes 1,420 writes Writes lost or changed 0 writes Stale reads 0 reads 95th percentile write time 0.04 sEvery scenario records one of three verdicts. Passed confirms both that the fault took effect and that every durability, latency and access promise held. Failed means at least one promise broke. Inconclusive means incomplete evidence prevented a clean check and never counts as a pass.
Failed and inconclusive runs stay on the public record beside passes, and failed evidence is kept until the underlying bug is fixed. In the Access group, fault injection pairs network splits and server crashes with credential revocation so even a lagging replica must refuse every read from a grant Ada just revoked.
Next, review every guarantee and pick a guide for your stack.