Limited Time Offer:Up to 20% off Hello Interview Premium
Up to 20% off Hello Interview Premium 🎉
Hello Interview
Your Dashboard
System Design
Code
Low Level Design
Behavioral
AI Coding
New
ML System Design
Salary Negotiation
Interview Guides
Blog
System Design
Low Level Design
AI Coding
Behavioral
New
Interview Questions
Success Stories
System Design
Low-Level Design
New
Ask The Community
Discord
Mock Interviews
1:1 Mentorship
Refer a Friend
Pricing
Sign in / Sign up
Search
⌘K
Pricing

Tutor

Leaky Bucket Rate Limiter

Implement a leaky bucket rate limiter with a fixed drain rate and finite capacity, supporting a `try_acquire(n)` method that returns whether a request is allowed or the wait time until it would be. Include unit tests for steady-state, burst, and edge case behavior, and discuss concurrency safety and distributed extension strategies.

Asked at:

Box


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Company
​
Level
All Regions
Region

Mid April, 2026

Box

Senior

Implement a Leaky-Bucket Rate Limiter with Tests and Distributed Design Context and Assumptions Implement in a general-purpose language; the reference solution uses Python 3 for clarity and unit tests. Leaky bucket semantics: a fixed drain rate r units/sec, a finite capacity b units. Each request consumes 1 unit unless specified otherwise. The bucket "leaks" continuously at rate r. The limiter should support: try_acquire(n=1) that returns whether a request of size n is allowed now and, if not, the wait time until it would be allowed. Unit tests for steady-state, burst, and boundary conditions. Discussion of concurrency safety (multi-thread/process) and distributed extension (e.g., Redis) with consistency & failure-mode considerations. Task Implement a leaky-bucket rate limiter enforcing a maximum average request rate with a fixed drain rate. Write unit tests to validate: Steady-state behavior at/under the configured rate. Burst behavior up to capacity. Boundary/edge conditions (precision, zero/near-zero time deltas, exact thresholds). Explain how to make the limiter safe under concurrency. Propose a design to extend it in a distributed setting (e.g., Redis), including consistency and failure-mode considerations.

Your account is free and you can post anonymously if you choose.

Hello Interview Premium

Recent interview questions
System Design Guided Practice
Exclusive content
Learn More
Questions
Meta SWE Interview QuestionsAmazon SWE Interview QuestionsGoogle SWE Interview QuestionsOpenAI SWE Interview QuestionsEngineering Manager (EM) Interview Questions
Learn
Learn System DesignLearn DSALearn BehavioralLearn ML System DesignLearn Low Level DesignGuided Practice
Links
FAQPricingGift PremiumHello Interview Premium
Legal
Terms and ConditionsPrivacy PolicySecurity
Contact
About UsProduct Support

7511 Greenwood Ave North Unit #4238 Seattle WA 98103


© 2026 Optick Labs Inc. All rights reserved.