An alternative approach to rate limiting
Nikrad Mahdi
1K19

You can implement leaky bucket atomicly with Reids using Eval. Simply use Redis hashes to store drain rate, last time of insert, fullness, and max capacity. Then use an EVAL script to calculate the fullness of the bucket and drain the appropriate load atomically. Reject the EVAL if it is full.

Like what you read? Give Nicholas Wong a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.