← Questions

Design a quota service

0
GoogleAmazonMicrosoft+1System designLast asked May 2026

A system design interview question asked in Google's first round (coding) and at Snowflake, Amazon and 1 more company, last asked May 2026. It tests rate limiting, consistency and multi-tenant.

Design an internal quota service that several products share. For example, each user has one storage allowance of 100 GB, and file storage, photos and email all draw from that same pool. Before storing anything, a product asks the quota service whether the user has room. The service owns the one authoritative number of how much space each user has left, and must answer fast enough that products can wait on it.

Requirements

  • Functional: consume quota; release quota (when data is deleted); query current usage and remaining quota; set and change limits per user or plan.
  • Non-functional: never let a user go over their limit, even under concurrent requests from several products and regions; highly available; low latency; millions of daily users and high request rates.

Clarifying questions

  • Is overdraft truly never allowed, or is a small temporary overshoot acceptable?
  • Is a request a single step, or do products reserve space before an upload and confirm after?
  • Are users served from several regions, and can one user write in two regions at once?
  • What happens to quota reserved by an upload that never finishes?
  • How should the service behave when it is unavailable: block writes or allow them?

What a strong answer covers

  • An API with reserve, confirm, release and query, each with an idempotency key so retries never count twice.
  • Quota states (available, reserved with a time limit, used) and a sweeper that expires abandoned reservations.
  • A data model per user (limit, used, reserved) in a store with atomic conditional updates or transactions, and why strong consistency is needed here.
  • Concurrency across products: compare-and-set or row locks so two simultaneous consumes cannot both pass the check.
  • Partitioning by user, a home region per user for writes, and failover; whether caching is safe and how.
  • Hot users, rate limiting and backpressure, reconciliation against actual stored data, and monitoring.

Follow-ups

  • A product crashes after reserving quota and never confirms. What happens?
  • A user's family plan shares one quota among five people.
  • The primary region fails. How do you fail over without allowing overdraft?
  • Products want to check quota without calling the service on every write.

Where it's asked

What it tests

rate limiting · consistency · multi-tenant

Your canvas
Draw your answer hereBoxes, arrows and notes, saved for you to come back to.Sign in to start drawing