PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/System Design/Microsoft

Design a simple API rate limiter

Last updated: Mar 29, 2026

Quick Overview

This question evaluates competency in designing scalable, low-latency API rate limiting, covering distributed-systems reasoning, storage and caching trade-offs, algorithmic trade-offs, consistency, and atomicity concerns.

  • hard
  • Microsoft
  • System Design
  • Software Engineer

Design a simple API rate limiter

Company: Microsoft

Role: Software Engineer

Category: System Design

Difficulty: hard

Interview Round: Onsite

Design a **rate limiter** for an API. ### Scenario You operate an HTTP API (e.g., `/v1/*`). You need to prevent abuse by limiting request rates. ### Requirements (clarify/assume if not provided) - Enforce limits such as: **N requests per minute** per client (e.g., per userId or per IP). - Return an appropriate response when a request is rejected (e.g., HTTP `429 Too Many Requests`). - Low latency (rate check should be fast). - Should work across **multiple API servers** (distributed setting). ### What to cover - API/interface and what key you rate-limit on (IP, userId, API key, route, etc.). - Algorithm choice (fixed window, sliding window, token bucket, leaky bucket) and trade-offs. - Data storage (in-memory vs Redis/memcache) and how to ensure atomicity. - Handling bursts, clock skew, failures, and observability (metrics/logging).

Quick Answer: This question evaluates competency in designing scalable, low-latency API rate limiting, covering distributed-systems reasoning, storage and caching trade-offs, algorithmic trade-offs, consistency, and atomicity concerns.

Related Interview Questions

  • Design A Scalable Web Crawler - Microsoft (medium)
  • Design User Re-engagement Notifications - Microsoft (medium)
  • Design a typeahead search service - Microsoft (hard)
  • Design a Secure Copilot API - Microsoft
  • Design a URL Shortener - Microsoft (hard)
Microsoft logo
Microsoft
Feb 11, 2026, 12:00 AM
Software Engineer
Onsite
System Design
5
0
Loading...

Design a rate limiter for an API.

Scenario

You operate an HTTP API (e.g., /v1/*). You need to prevent abuse by limiting request rates.

Requirements (clarify/assume if not provided)

  • Enforce limits such as: N requests per minute per client (e.g., per userId or per IP).
  • Return an appropriate response when a request is rejected (e.g., HTTP 429 Too Many Requests ).
  • Low latency (rate check should be fast).
  • Should work across multiple API servers (distributed setting).

What to cover

  • API/interface and what key you rate-limit on (IP, userId, API key, route, etc.).
  • Algorithm choice (fixed window, sliding window, token bucket, leaky bucket) and trade-offs.
  • Data storage (in-memory vs Redis/memcache) and how to ensure atomicity.
  • Handling bursts, clock skew, failures, and observability (metrics/logging).

Solution

Show

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More System Design•More Microsoft•More Software Engineer•Microsoft Software Engineer•Microsoft System Design•Software Engineer System Design
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

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

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL 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.