PracHub
QuestionsLearningGuidesInterview Prep
|Home/System Design/Pinterest

Design a Distributed Rate-Limiting Service

Last updated: Jul 14, 2026

Quick Overview

Design a distributed rate limiter for per-user, per-tenant, route, and global API policies under a tight latency budget. Make accuracy and availability trade-offs explicit across token algorithms, atomic counters, sharding, hot keys, local leases, bounded regional overshoot, partitions, and fail-open or fail-closed behavior.

  • medium
  • Pinterest
  • System Design
  • Software Engineer

Design a Distributed Rate-Limiting Service

Company: Pinterest

Role: Software Engineer

Category: System Design

Difficulty: medium

Interview Round: Take-home Project

# Design a Distributed Rate-Limiting Service Design a rate-limiting service that protects APIs across many application instances. It should support per-user, per-tenant, and global limits while making an explicit trade-off among accuracy, latency, availability, and cost. ### Constraints & Assumptions - The limiter runs on the request path and must respond within a small latency budget. - Application instances and limiter nodes may restart or become partitioned. - Limits can change at runtime and can differ by route, identity, and plan. - Requests can be retried, and one tenant may generate a sudden burst. - Some endpoints require fail-closed behavior while others may fail open with bounded risk. ### Clarifying Questions to Ask - Are limits fixed-window, sliding-window, token-bucket, concurrency, or a combination? - What overshoot is acceptable during replication delay or partition? - Which identity is trusted, and how is it derived behind proxies? - What traffic scale, regional topology, and decision latency are expected? - Which routes fail open, fail closed, or use an emergency local limit? ### Hints - Define an exact decision API and response metadata. - Keep configuration distribution separate from hot-path counter state. - Compare centralized counters with locally leased token budgets. ### What a Strong Answer Covers - Key construction, policy precedence, algorithm choice, burst semantics, and response headers. - Atomic counter or token updates, sharding, hot-key handling, expiration, and clock behavior. - Multi-region consistency, local token leases, bounded overshoot, and partition policy. - Configuration versioning, staged rollout, emergency overrides, and auditability. - Authentication, spoofing resistance, tenant isolation, retries, and denial-of-service protection for the limiter itself. - Metrics, shadow evaluation, capacity planning, graceful degradation, and correctness tests. ### Follow-up Questions 1. How would you bound global-limit overshoot with active-active regions? 2. What happens when one celebrity account becomes a single hot counter key? 3. How would you roll out a stricter policy without unexpectedly blocking valid traffic? 4. When is a local approximate limiter safer than a remote exact one?

Quick Answer: Design a distributed rate limiter for per-user, per-tenant, route, and global API policies under a tight latency budget. Make accuracy and availability trade-offs explicit across token algorithms, atomic counters, sharding, hot keys, local leases, bounded regional overshoot, partitions, and fail-open or fail-closed behavior.

Related Interview Questions

  • 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 Distributed Rate-Limiting Service

Pinterest logo
Pinterest
Jul 2, 2026, 12:00 AM
mediumSoftware EngineerTake-home ProjectSystem Design
1
0

Design a Distributed Rate-Limiting Service

Design a rate-limiting service that protects APIs across many application instances. It should support per-user, per-tenant, and global limits while making an explicit trade-off among accuracy, latency, availability, and cost.

Constraints & Assumptions

  • The limiter runs on the request path and must respond within a small latency budget.
  • Application instances and limiter nodes may restart or become partitioned.
  • Limits can change at runtime and can differ by route, identity, and plan.
  • Requests can be retried, and one tenant may generate a sudden burst.
  • Some endpoints require fail-closed behavior while others may fail open with bounded risk.

Clarifying Questions to Ask Guidance

  • Are limits fixed-window, sliding-window, token-bucket, concurrency, or a combination?
  • What overshoot is acceptable during replication delay or partition?
  • Which identity is trusted, and how is it derived behind proxies?
  • What traffic scale, regional topology, and decision latency are expected?
  • Which routes fail open, fail closed, or use an emergency local limit?

Hints

  • Define an exact decision API and response metadata.
  • Keep configuration distribution separate from hot-path counter state.
  • Compare centralized counters with locally leased token budgets.

What a Strong Answer Covers Guidance

  • Key construction, policy precedence, algorithm choice, burst semantics, and response headers.
  • Atomic counter or token updates, sharding, hot-key handling, expiration, and clock behavior.
  • Multi-region consistency, local token leases, bounded overshoot, and partition policy.
  • Configuration versioning, staged rollout, emergency overrides, and auditability.
  • Authentication, spoofing resistance, tenant isolation, retries, and denial-of-service protection for the limiter itself.
  • Metrics, shadow evaluation, capacity planning, graceful degradation, and correctness tests.

Follow-up Questions Guidance

  1. How would you bound global-limit overshoot with active-active regions?
  2. What happens when one celebrity account becomes a single hot counter key?
  3. How would you roll out a stricter policy without unexpectedly blocking valid traffic?
  4. When is a local approximate limiter safer than a remote exact one?

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 8,500+ 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.