TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

We scaled the GitHub API with a sharded, replicated rate limiter in Redis

143 pointsby prakhargurunaniabout 4 years ago

6 comments

rattrayabout 4 years ago
The article mentions they took some inspiration from a Stripe blogpost&#x2F;gist; for convenience, here&#x27;s the direct link to the relevant lua code (helps compare what is interesting&#x2F;unique about github&#x27;s approach):<p><a href="https:&#x2F;&#x2F;gist.github.com&#x2F;ptarjan&#x2F;e38f45f2dfe601419ca3af937fff574d#file-request_rate_limiter-lua" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;ptarjan&#x2F;e38f45f2dfe601419ca3af937fff...</a><p>(disclaimer, I worked on the rate limiter at Stripe a bit, but can&#x27;t remember how similar the 2019-era code was to what you see there; I think broadly similar).
评论 #26741549 未加载
评论 #26742925 未加载
junonabout 4 years ago
This is strange to me. Did Github do client-based sharding because they were trying to get around the upfront key enumeration limitation in Lua scripts? Why didn&#x27;t they use the cluster&#x27;s ability to proxy requests to the appropriate sharded worker?<p>As-is, they could have just passed `rate_limit_key+&#x27;:exp&#x27;` as a second KEYS entry and it would have ensured the key existed for operation. They were deriving keys off of apriori information, so they could have just as easily foregone the client-side complexity and just put the redis cluster in a sharded configuration.<p>I wonder what sorts of performance impact this had (the page doesn&#x27;t mention it). Client-side sharding almost certainly increased the codebase complexity and it doesn&#x27;t seem like they measured any real impact from doing it this way (or maybe they just chose not to report it).
评论 #26743540 未加载
gigatexalabout 4 years ago
We had a saying at my old job: if something’s broken it’s never Redis. Redis is such a tank in my experience. We set it up. Secured it. And then forgot about it.
评论 #26740365 未加载
评论 #26741059 未加载
评论 #26741471 未加载
评论 #26743299 未加载
tayloramurphyabout 4 years ago
I originally thought this article was going to be about John Berryman&#x27;s proposed Redis rate limiter [0]<p>[0] <a href="http:&#x2F;&#x2F;blog.jnbrymn.com&#x2F;2021&#x2F;03&#x2F;18&#x2F;estimated-average-recent-request-rate-limiter.html" rel="nofollow">http:&#x2F;&#x2F;blog.jnbrymn.com&#x2F;2021&#x2F;03&#x2F;18&#x2F;estimated-average-recent-...</a>
fasteoabout 4 years ago
Related: mailgun’s gubernator[1]. No redis.<p>[1] <a href="https:&#x2F;&#x2F;www.mailgun.com&#x2F;blog&#x2F;gubernator-cloud-native-distributed-rate-limiting-microservices&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.mailgun.com&#x2F;blog&#x2F;gubernator-cloud-native-distrib...</a>
cylde_frogabout 4 years ago
Can anyone make a comparison between GCRA and the sliding window algorithm? Why is GCRA superior?