Design Per-Container Request Quotas for the CloudKit Public Database
Last updated: November 29, 2026
Quick Overview
Design quota enforcement for CloudKit so each app's container gets request and bandwidth limits that scale with its active users, rejecting abusive traffic without hurting normal apps.
Apple
November 29, 20260
0
0 solved
Design quota enforcement for CloudKit so each app's container gets request and bandwidth limits that scale with its active users, rejecting abusive traffic without hurting normal apps.
CloudKit gives developers a free tier that grows with their user count, so quotas are tied to business rules, not just a fixed rate. The interviewer checks a clean rate limiting algorithm, where state lives, and how limits are communicated to clients.
What the Interviewer Expects
- Chooses a token bucket and explains burst versus sustained rate
- Derives limits from the container's active-user count, recomputed periodically
- Keeps counters in a fast shared store with local batching to avoid a hot key
- Returns clear errors with retry-after so CloudKit clients back off
- Separates per-user limits inside a container from per-container limits
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- How do you prevent one abusive user from exhausting an app's whole quota?
- What happens to enforcement if the counter store is unavailable?
- How would you show developers their usage in the CloudKit Console?
- How do limits differ for the private database, which counts against the user's iCloud storage?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
- Limits per container: requests per second and transfer per day, scaling with active users (for example a base plus a per-user allowance).
- Per-user sub-limit to contain one bad client.
- Decision l...
High-Level Design
- Quota config service: nightly job computes each container's active users and writes limits.
- API gateway: on each request, check the user bucket and container bucket.
- Counter store: R...