Building a Sliding Window Rate Limiter for a Video API With Redis

php dev.to

Last month our trending-videos endpoint started returning garbage latency numbers. Not because the queries got slower, but because a handful of clients discovered they could hammer /api/v1/trending?region=DE a few thousand times a minute and our fixed-window rate limiter happily let them through in bursts. The window would reset at the top of each minute, every scraper on the planet would fire at :00, and our SQLite WAL readers would spike hard enough to blow through the LiteSpeed request budget

Read Full Tutorial open_in_new
arrow_back Back to Tutorials