HLDArena
HLD-332·Caching & Consistency
Hard · 1,500 pts

Global Relationship-Based Access Control Engine (Zanzibar-Style)

Design a Google Zanzibar / SpiceDB-style global permissions service evaluating nested group-membership and folder-inheritance relation tuples (`doc:readme#viewer@group:eng#member`) at 180k+ Check RPS while preventing the "New Enemy" stale-ACL bug via consistency tokens (`zedtoken` / `zookie`).

Max p99
≤ 45 ms
Availability
≥ 99.7%
Budget
≤ $8,600

Functional Requirements

  • FR-1POST /v1/permissions/check — Evaluates transitive relation graph for `(object, relation, subject)` honoring caller consistency token.
  • FR-2POST /v1/permissions/tuples — Atomically writes or revokes ACL relation tuples and emits monotonic revision token (`zookie`).
  • FR-3GET /v1/permissions/expand/{object_id} — Expands effective subject tree for sharing-dialog previews and security audits.
  • FR-4Must guarantee revoked users never read post-revocation content ("No New Enemy" invariant) at p99 <= 45 ms across node failures.

Workload Profile

Every-RPC ACL Checks74,000 Check Read RPS / 6,500 Tuple Grant/Revoke Write RPS
Org Re-Org + Shared Folder Storm188,000 Check Read RPS / 16,000 Tuple Write RPS
Active Working Set44 GB hot relation tuples, Leopard-style group membership bitsets & check cache
Security InvariantSnapshot Check >= zookie revision ("No New Enemy") + sub-45ms p99

Consistency Model

Bounded snapshot reads gated by caller revision token (`at_least_as_fresh >= zookie`) so ACL revocations take immediate effect on protected objects.

Relevant practice for

Click an item in Inventory above, or press B to add a component, double-click to name, C to connect.

Design Write-up

Write under ### Architecture for Diagram to take that up directly

Compulsory section · if not written yet, Diagram reads from the start of your write-up.
Architecture: required·FRs mentioned: 0/4·0 boxes · 0 edges
0 words
Hidden Cases #4–#7 run automatically on Submit
Case 1: Smoke & API ContractInput Workload
Read RPS
2,000 rps
Write RPS
400 rps
Key Distribution
Uniform (Low Skew)
Chaos Fault
None (Healthy Cluster)
Expected Pass CriteriaASSERTIONS
• Tail Latency: p99 ≤ 90 ms
• Availability: ≥ 99.7%
Valid end-to-end Client → Compute → Storage topology