Bird
Raised Fist0
HLDsystem_design~20 mins

Design a rate limiter in HLD - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Rate Limiter Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Rate Limiter Algorithm Choice

You want to limit the number of requests a user can make to an API to 100 requests per minute. Which rate limiting algorithm is best suited to allow some bursts but still enforce the limit?

AToken bucket
BSliding window log
CFixed window counter
DLeaky bucket
Attempts:
2 left
💡 Hint

Think about which algorithm allows bursts but controls the average rate.

Architecture
intermediate
2:00remaining
Distributed Rate Limiter Design

You need to design a rate limiter that works across multiple servers handling user requests. Which component is essential to ensure consistent rate limiting across all servers?

ALocal in-memory counters on each server
BSeparate rate limiters per server without coordination
CA centralized data store shared by all servers
DClient-side rate limiting only
Attempts:
2 left
💡 Hint

Think about how to keep counters consistent across servers.

scaling
advanced
3:00remaining
Scaling Rate Limiter for High Traffic

Your API receives millions of requests per minute. Which approach best scales the rate limiter to handle this load without becoming a bottleneck?

AShard counters across multiple Redis instances by user ID
BUse a single Redis instance to store all counters
CStore counters in a relational database with transactions
DKeep counters only in server memory without persistence
Attempts:
2 left
💡 Hint

Consider how to distribute load and avoid single points of failure.

tradeoff
advanced
3:00remaining
Tradeoffs Between Accuracy and Performance

Which rate limiting approach trades off some accuracy for better performance and lower storage needs?

ASliding window log storing every request timestamp
BFixed window counter resetting every minute
CToken bucket with approximate counters
DLeaky bucket with exact queue of requests
Attempts:
2 left
💡 Hint

Think about which method uses less data but can cause bursts at window edges.

estimation
expert
3:00remaining
Capacity Estimation for Rate Limiter Storage

You expect 10 million users, each allowed 100 requests per minute. You want to store counters for each user in Redis with 8 bytes per counter. Estimate the minimum memory needed to store counters for all users for a 1-minute window.

AApproximately 80 GB
BApproximately 80 MB
CApproximately 8 GB
DApproximately 800 MB
Attempts:
2 left
💡 Hint

Calculate: 10 million users * 8 bytes per counter.