Jeff Dwyer By Jeff Dwyer • February 17, 2017

A Distributed RateLimit Library for Ruby

Launching ratelimit-ruby, a gem for distributed rate limits

As of this post, ratelimit-ruby is now at 0.1.10 and ready for you to give it a whirl. You likely found this post because you're trying to figure out how to have a whole bunch of background jobs not crush a 3rd party rate limit. Or perhaps you're trying to save money on your MixPanel bill by not sending an event every single time somebody loads a page. Or perhaps you're trying to figure out the easiest way to build a distributed lock for your Ruby on Rails app. Either way, you're in luck! Ratelimit-ruby support all of this and is dead simple to use. Specifically it supports:

  • Millions of individual rate limits (enough for one per person per event type)
  • WebUI for tweaking limits & feature flags
  • Logging to help you debug
  • Concurrency & Semaphores
  • Infinite retention for deduplication workflows
  • FeatureFlags as a Service (yeah, these are not rate limits but we are addicted to feature flags and can't live without them and it was just as easy to build it for everybody as it was to build it for just ourselves so.. um.. you're welcome!)

Wait, as a service? How much does this cost?

Another service to pay for?  Oh man. What is this, leftpad.io?  Fair point, but I think you'll like it once you try it. Once you've got a super scalable ratelimit service as a hammer I have a feeling you'll find you can save money just about everywhere. And at $.000005 per limit check, well.... that's a lot of checks before you get to your first dollar.

Example or it didn't happen

Ok ok, here you go, a little teaser:


Easy peasy right? Check out the rest of the documentation.

Give it a try!