Building Ratequeue

November 2012

At Twilio, I built Ratequeue, a fast, scalable, fault-tolerant distributed task queue that can be used to rate-limit items from a large, dynamic set of open queues. Ratequeue provides multi-tenant safe queuing and traffic shaping for all of Twilio's outbound calls and SMS messages originating into carrier networks, handling millions of transactions per day. This talk discusses the architecture of the system as well as the details of how the Lua scripts work to manipulate Redis into efficiently enforcing rate-limits for many open queues across a cluster.