PracHub
QuestionsLearningGuidesInterview Prep
|Home/System Design/Pinterest

Design a high-throughput distributed rate limiter

Last updated: Jun 15, 2026

Quick Overview

Pinterest software-engineer onsite system-design question: design a multi-region, high-throughput distributed rate limiter targeting ~10M req/s with per-user, per-API, and global limits, burst tolerance, and an approximately-sliding window. It tests token-bucket/GCRA algorithm choice, an architecture of local in-process buckets fed by epoch-based token leases, consistent-hashing sharding with hot-key splitting, bounded-overshoot consistency, fault handling, fairness, capacity-planning math (including a 2× spike), backpressure, and observability.

  • hard
  • Pinterest
  • System Design
  • Software Engineer

Design a high-throughput distributed rate limiter

Company: Pinterest

Role: Software Engineer

Category: System Design

Difficulty: hard

Interview Round: Onsite

##### Question Design a high-throughput, distributed rate-limiting service that runs across multiple regions with low latency and burst tolerance. The service must enforce limits along several dimensions — per-user, per-API/route, the user×API combination, and an optional global cap — and approximate a sliding window. Target roughly 10M requests/second at peak. Cover the following: 1. **Algorithm choice.** Pick and justify an enforcement algorithm (e.g. token bucket vs. leaky bucket, and GCRA). Explain how you get burst tolerance and an approximately-sliding window, and how you compute `Retry-After`. 2. **API design.** Specify the on-request decision API (check-and-consume), the off-path budget/lease API, the policy (configuration) API, and an introspection/metrics API. 3. **Data model.** Define the policy schema and the per-key bucket state (rate, burst, tokens, last-refill timestamp, lease/epoch state). 4. **Architecture.** Describe how decisions are made on the request path with low latency — in particular how you avoid a remote/cross-region hop on every request (e.g. local in-process buckets fed by leased token budgets). 5. **Sharding and hot keys.** Partition the key space (consistent hashing with virtual nodes / bounded load) and mitigate hot keys (key splitting, dynamic split detection, single-writer fallback). 6. **Storage choices.** Compare in-memory vs. Redis vs. a custom store for enforcement counters, policy config, and telemetry. Justify why per-request Redis does not scale to 10M RPS. 7. **Clock and time-window semantics.** Handle refill timing, epoch boundaries, and clock skew across nodes and regions. 8. **Consistency trade-offs.** State what consistency you provide per-user/per-region vs. globally, and the bound on global overshoot. Show how to get strong consistency for a small subset of keys when required. 9. **Failures and partial outages.** Handle owner/coordinator unavailability, regional partitions, node failure, and duplicate requests (idempotency), including fail-open vs. fail-closed policy and refunds. 10. **Fairness.** Ensure fairness across users/tenants and, for global limits, across regions (e.g. demand-aware water-filling). 11. **Capacity planning and scaling.** Give the math for per-node throughput and machine count at baseline, how many machines to add for a 2× traffic spike, the autoscaling signals to watch, and backpressure/throttling strategy. 12. **Observability.** List the key metrics, traces, and alerts.

Quick Answer: Pinterest software-engineer onsite system-design question: design a multi-region, high-throughput distributed rate limiter targeting ~10M req/s with per-user, per-API, and global limits, burst tolerance, and an approximately-sliding window. It tests token-bucket/GCRA algorithm choice, an architecture of local in-process buckets fed by epoch-based token leases, consistent-hashing sharding with hot-key splitting, bounded-overshoot consistency, fault handling, fairness, capacity-planning math (including a 2× spike), backpressure, and observability.

Related Interview Questions

  • Design a Distributed Rate-Limiting Service - Pinterest (medium)
  • Design a Multi-Channel Notification System - Pinterest (medium)
  • Design a Distributed Rate Limiter - Pinterest (medium)
  • Design Catalog Update Pipeline - Pinterest (medium)
  • Design an ads event reporting system - Pinterest (medium)
|Home/System Design/Pinterest

Design a high-throughput distributed rate limiter

Pinterest logo
Pinterest
Sep 6, 2025, 12:00 AM
hardSoftware EngineerOnsiteSystem Design
13
0
Question

Design a high-throughput, distributed rate-limiting service that runs across multiple regions with low latency and burst tolerance. The service must enforce limits along several dimensions — per-user, per-API/route, the user×API combination, and an optional global cap — and approximate a sliding window. Target roughly 10M requests/second at peak. Cover the following:

  1. Algorithm choice. Pick and justify an enforcement algorithm (e.g. token bucket vs. leaky bucket, and GCRA). Explain how you get burst tolerance and an approximately-sliding window, and how you compute Retry-After .
  2. API design. Specify the on-request decision API (check-and-consume), the off-path budget/lease API, the policy (configuration) API, and an introspection/metrics API.
  3. Data model. Define the policy schema and the per-key bucket state (rate, burst, tokens, last-refill timestamp, lease/epoch state).
  4. Architecture. Describe how decisions are made on the request path with low latency — in particular how you avoid a remote/cross-region hop on every request (e.g. local in-process buckets fed by leased token budgets).
  5. Sharding and hot keys. Partition the key space (consistent hashing with virtual nodes / bounded load) and mitigate hot keys (key splitting, dynamic split detection, single-writer fallback).
  6. Storage choices. Compare in-memory vs. Redis vs. a custom store for enforcement counters, policy config, and telemetry. Justify why per-request Redis does not scale to 10M RPS.
  7. Clock and time-window semantics. Handle refill timing, epoch boundaries, and clock skew across nodes and regions.
  8. Consistency trade-offs. State what consistency you provide per-user/per-region vs. globally, and the bound on global overshoot. Show how to get strong consistency for a small subset of keys when required.
  9. Failures and partial outages. Handle owner/coordinator unavailability, regional partitions, node failure, and duplicate requests (idempotency), including fail-open vs. fail-closed policy and refunds.
  10. Fairness. Ensure fairness across users/tenants and, for global limits, across regions (e.g. demand-aware water-filling).
  11. Capacity planning and scaling. Give the math for per-node throughput and machine count at baseline, how many machines to add for a 2× traffic spike, the autoscaling signals to watch, and backpressure/throttling strategy.
  12. Observability. List the key metrics, traces, and alerts.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More System Design•More Pinterest•More Software Engineer•Pinterest Software Engineer•Pinterest System Design•Software Engineer System Design

Your design canvas — auto-saved

PracHub

Master your tech interviews with 9,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.