Bird
0
0

How would you modify a token bucket algorithm to handle multiple API clients each with their own rate limits?

hard📝 Application Q9 of 15
Rest API - Rate Limiting and Throttling

How would you modify a token bucket algorithm to handle multiple API clients each with their own rate limits?

AIncrease refill rate to handle all clients
BMaintain separate token buckets per client
CUse a single shared token bucket for all clients
DRemove token bucket and use fixed delay
Step-by-Step Solution
Solution:
  1. Step 1: Understand per-client rate limiting need

    Each client needs its own limit to avoid interference.
  2. Step 2: Implement separate token buckets

    Assign a token bucket to each client to track tokens independently.
  3. Final Answer:

    Maintain separate token buckets per client -> Option B
  4. Quick Check:

    Separate buckets per client [OK]
Quick Trick: Use one bucket per client for separate limits [OK]
Common Mistakes:
  • Sharing one bucket for all clients
  • Increasing refill rate incorrectly
  • Removing rate limiting

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes