Skip to content

Exhibit Code - Token Bucket Rate Limiter

Published: at 09:35 PM

If you’ve read Alex Xu’s System Design Interview you’ve likely come across the chapter on rate limiters (chapter 4 to be exact). I’ve worked with other types of rate limiters in the past but not the token bucket kind. With that in mind, I decided to build a quick prototype of one in Ruby.

These kinds of prototypes is something that I would put together in my last role as Lead Software Engineer at NationBuilder as a way to foster collboration and as a form of mentoring. With that in mind, this is clearly not something that should be used in a production environment.

You can see this at the Github repo that I put together at https://github.com/eddorre/token_bucket_rate_limiter and a quick example of it running:

Token Bucket Rate Limiter Runtime Example


Previous Post
On Using AI Tools for Learning
Next Post
SimpleSpec - A Tiny Ruby Testing Library