Building global permissions is rarely defeated by raw read throughput; it breaks when an old permission snapshot is evaluated against brand-new content. In their 2019 USENIX ATC paper, Ruoming Pang and 13 Google co-authors showed how Zanzibar unifies access control across Calendar, Cloud, Drive, Maps, Photos, and YouTube while keeping permission checks causally consistent with out-of-band edits to documents and groups.
Instead of forcing every authorization check through a global leader round trip, Zanzibar stores relation tuples in Spanner and passes an opaque timestamp token (zookie) across the boundary between content storage and access control. That architecture inspired nearly every modern relationship-based access control (ReBAC) engine, from SpiceDB and OpenFGA to Ory Keto.
- Global planet scale: Zanzibar manages more than
1,500namespaces holding over2 trillionrelation tuples (~100 TB), replicated across30+locations and served by10,000+servers. - 10M+ QPS with local reads: during a 7-day December 2018 window,
Readpeaked near8.2MQPS,Checkat4.2MQPS,Expandat760KQPS, andWriteat25KQPS. - Sub-10 ms tail latency:
Check Safe(local replica reads) held3.0 msmedian and9.46 ms95th-percentile latency, whileCheck Recent(cross-region fresh reads) hit60.0 msat p95. - Five-nines availability: replay probers measured over
99.999%availability across three years of production operation (under2 minutesof global downtime per quarter).
Relation tuples and the “new enemy” problem
Zanzibar represents every permission and group membership as a normalized relation tuple: object#relation@user, where object pairs a namespace with an ID (doc:readme), relation is a client-defined role (owner, editor, viewer, member), and user is a user ID or another userset (group:eng#member). Namespace configs compose relations without per-file tuple bloat using userset_rewrite rules: this reads stored tuples, computed_userset maps relations on the same object (owner implies editor), and tuple_to_userset follows edges like parent folders (viewer of folder:A becomes viewer of doc:readme), combined via union, intersection, and exclusion.
Normalization simplifies updates, yet creates a subtle bug the authors call the “new enemy” problem. Suppose Alice removes Bob from a folder’s ACL, then asks Charlie (outside Zanzibar) to move sensitive files into that folder; or Alice removes Bob from a document, then asks Charlie to paste secret text into it. Under eventual consistency, a check on the new file or edit can hit a pre-removal ACL snapshot and let Bob read material created after he lost access.
Simpler distributed architectures fail here. Asynchronous graph stores like Facebook TAO risk out-of-order ACL evaluation; always-latest global reads destroy the 10 ms latency budget (PACELC); Lamport clocks cannot track Alice and Charlie talking out-of-band; and Chubby or ZooKeeper lack Zanzibar’s write scale or cross-node bounded-staleness snapshots.
External consistency via Spanner and the zookie protocol
Zanzibar resolves the tension between causal correctness and local latency by separating ordering from freshness. Underneath, every namespace stores its versioned relation tuples (shard ID, object ID, relation, user, commit timestamp) plus a shared changelog inside Google Spanner. Spanner’s TrueTime assigns microsecond commit timestamps that respect real-time causality: if Alice removes Bob before Charlie saves new content, Alice’s ACL write strictly receives a lower timestamp T1 < T2. Five Paxos voting replicas sit in three eastern and central US metro areas within 25 ms of each other so writes commit cleanly (at 127 ms median and 233 ms p95), while read-only replicas spread to more than 30 regions globally.
To prevent old ACLs from being paired with new content without paying leader latency on every read, Zanzibar introduces the zookie, an opaque token encoding a global timestamp. Before saving modified content, the application sends a content-change check (evaluated at the latest snapshot). Zanzibar authorizes the edit and returns a fresh zookie Tc, which the application writes atomically alongside the new content version. Every later Check for that content version passes Tc, requiring Zanzibar to evaluate at a single consistent snapshot T >= Tc across all database reads.
That “at-least-as-fresh” contract gives Zanzibar freedom to stay fast. Because replication heartbeats run every 8 seconds, any request whose zookie is more than 10 seconds old (Check Safe) can usually be served from local replicas in the same zone, and Safe checks outnumber Recent checks (under 10 seconds old) by roughly two orders of magnitude. When clients omit a zookie, servers adaptively pick a default staleness using binomial proportion confidence intervals and two-proportion z-tests over recent out-of-zone read hints. Even namespace configuration changes stay consistent mid-fanout: a monitor tracks the config timestamp window available across every aclserver in a cluster so all subrequests share one config snapshot.
Pointer chasing, Leopard, and surviving hot spots
Consistent snapshots alone do not make an authorization graph fast. A standard Check evaluates a recursive boolean tree across Spanner; Zanzibar speeds this up by evaluating leaf nodes concurrently, cancelling sibling subtrees once a parent outcome is settled, and pooling Spanner reads (averaging 1.5 rows per RPC at median, rising near 1,000 rows at p99).
Deeply nested or wide enterprise groups still break pointer chasing, so Zanzibar routes them to Leopard, an in-memory set index. Leopard stores sorted integer skip lists for GROUP2GROUP(ancestor -> descendant_groups) and MEMBER2GROUP(user -> direct_groups), turning group checks into O(min(|A|, |B|)) intersections. Offline shards combine with an incremental layer tailing Zanzibar’s Watch API (where one tuple write can emit tens of thousands of index events), serving 1.56M QPS median (2.22M p99) in under 150 microseconds median (under 1 ms p99).
Bursty workloads such as Drive search (issuing dozens of checks per results page) also create hot spots on shared groups. Zanzibar stacks four defenses to keep Check Safe under 10 ms:
- Dual-side cache trees with quantized keys: servers route sub-checks via consistent hashing on
object_id(plus Slicer), caching results on both caller and callee across200Mcache lookups/sec. Rounding evaluation timestamps to 1-second or 10-second buckets lets concurrent checks share cache keys without breaking consistency. - Lock tables against stampedes: an in-memory lock table lets only one request compute an uncached key while peers wait. Delegate caches hit
10%on checks (24%on reads) and lock tables save another12%(9%on reads), eliminating500Khot internal RPCs/sec. - Hot-object prefetch and delayed cancellation: for the hottest
0.1%of objects, Zanzibar reads and caches the entireobject#relationtuple set upfront, and delays cancelling redundant subtrees while peers wait on that lock-table entry. - Deferred hedging and isolation: Zanzibar hedges slow Spanner and Leopard reads (
1%, or200K/s, hedged), never hedgesaclserver-to-aclserverchecks (which would duplicate expensive graph walks), and enforces per-clientcpu-secondsquotas and isolated lock keys.
Trace four production hazards on Zanzibar
Aggregating 10 million QPS into a single p95 number obscures how Zanzibar’s safeguards handle distinct failure modes. Switch across the four tabs below to inspect how causal ordering, deep groups, flash hot spots, and tail spikes are resolved in the paper.
Select a scenario (or use Left and Right arrow keys) to compare the naive bottleneck, Zanzibar's mechanism, and measured production evidence.
Revoked user reads freshly added document content
ConsistencyAlice removes Bob from a doc or folder, then tells Charlie out-of-band to move or add new sensitive data.
- Why naive fix breaks
- Eventual consistency can pair Bob's check with a pre-revocation ACL snapshot; always reading the latest global state causes cross-region latency spikes.
- Zanzibar's mechanism
- Client gets a content-change zookie Tc when saving edits and attaches Tc to later checks, forcing evaluation at T >= Tc on Spanner TrueTime.
- Measured evidence
- Check Safe (>10 s zookies) serves ~99% of checks locally at 3.0 ms p50 and 9.46 ms p95; Check Recent (<10 s) runs at 60.0 ms p95.
- Production impact
- Guarantees causal ordering across out-of-band human coordination while keeping nearly all reads in-region.
Nested enterprise hierarchies stall recursive pointer chasing
Query engineChecking whether a user belongs to a top-level company group fans out across many layers of subgroups.
- Why naive fix breaks
- Recursive Spanner RPCs multiply round trips and rows scanned (jumping from 1.5 rows median to ~1,000 rows at p99).
- Zanzibar's mechanism
- Leopard pre-flattens GROUP2GROUP and MEMBER2GROUP skip lists from offline shards plus real-time Watch deltas, solving checks via O(min(|A|, |B|)) intersection.
- Measured evidence
- Leopard serves 1.56M QPS median (2.22M p99) at under 150 microseconds median and under 1 ms at p99, ingesting 500 to 1.5K updates/s.
- Production impact
- Deeply nested org trees evaluate in sub-millisecond memory lookups at exact snapshot timestamps.
Viral document or shared search group triggers cache stampede
Hot spotsThousands of users hit the same popular object or search-result parent group simultaneously across a cluster.
- Why naive fix breaks
- Microsecond cache keys never collide, eager subtree cancellation leaves keys unpopulated, and single-user reads overload one Spanner tablet.
- Zanzibar's mechanism
- Quantize snapshots to 1 or 10 s buckets, cache on both caller and callee, coalesce misses via lock tables, and prefetch full tuple sets on hot 0.1% groups.
- Measured evidence
- 200M cache lookups/s plus lock tables (12% check savings, 9% read savings) trim 22M delegated RPCs/s and prevent 500K hot RPCs/s.
- Production impact
- Keeps normalized Spanner storage safe from thundering herds during viral spikes and multi-check search queries.
Slow storage read or noisy neighbor blows up search budgets
Tail latencyA single search page triggers dozens of checks, so one slow replica or overloaded client drags down p99.
- Why naive fix breaks
- Blindly hedging expensive top-level Check requests duplicates heavy graph traversals and amplifies cluster overload.
- Zanzibar's mechanism
- Defer hedging only for uniform Spanner/Leopard calls beyond a dynamic percentile threshold, paired with cpu-seconds quotas and per-client lock keys.
- Measured evidence
- Only 1% of Spanner reads (200K/s) trigger hedging; Check Safe p99 stays near 15.0 ms (peak 20 ms) across a 7-day trace.
- Production impact
- Cuts storage tail jitter with minimal extra traffic while isolating noisy tenants.
If you prefer the short version without clicking through each tab, here is how those four mechanisms work together:
- New enemy: content-change
zookietokens enforceT >= Tcon Spanner snapshots, letting~99%of checks (Check Safe) read locally at3.0 msmedian without risking stale-ACL leaks. - Deep groups: Leopard trades Watch-stream denormalization (
500to1.5Kincremental writes/s) forO(min(|A|, |B|))skip-list intersections under150 microsecondsmedian. - Hot object: coarse timestamp quantization, dual-sided caches, lock-table coalescing, and full-set prefetching shield Spanner behind
200Mcache lookups/sec. - Tail spike: deferred hedging covers uniform Spanner and Leopard calls (
1%hedged), whilecpu-secondsquotas and isolated lock keys contain noisy clients.
Caveats and what changed after Zanzibar
Three engineering caveats keep Zanzibar’s architecture in proper perspective for teams building outside Google.
First, Zanzibar depends on Google-internal infrastructure that few organizations possess. Section 4.4 explicitly notes that Zanzibar runs on internal Google Spanner rather than public Cloud Spanner, relying on TrueTime hardware clocks and 5 voting replicas within 25 ms across three metro areas. Open-source ReBAC descendants such as SpiceDB and OpenFGA have had to replicate zookie semantics using CockroachDB, PostgreSQL MVCC transaction snapshots, or hybrid logical clocks, trading some cross-region write geometry for deployability.
Second, Leopard’s denormalization carries strict write-amplification limits. A single group-to-group tuple edit in Zanzibar can expand into tens of thousands of Leopard incremental index updates, and every Leopard serving instance must ingest the full Watch stream for those namespaces. That works cleanly when reads outnumber writes by two orders of magnitude (8.2M Read QPS vs. 25K Write QPS), yet breaks down on write-heavy ACL graphs where membership edges churn faster than incremental skip-list merging can absorb.
Third, Zanzibar intentionally stops at relationship graph authorization. It does not store object metadata or execute arbitrary attribute-based predicates over dynamic request context (such as IP geolocation, time-of-day windows, or billing quotas); clients must compose those checks alongside Check or Expand.
For backend engineers designing authorization today, the enduring takeaway is not “build a 10,000-server Spanner cluster.” It is the boundary contract: unify permissions as composable object#relation@user tuples, attach an opaque freshness token (zookie) to every content mutation so caches never apply yesterday’s permissions to today’s data, and separate normalized consistency from read-path acceleration only where deep hierarchies actually demand it.
