-
Notifications
You must be signed in to change notification settings - Fork 379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add redis-based quota.Manager #1977
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Andrew, this is super cool!
A few minor nits inline.
Ah, there are a couple of other bits the presubmit picked up, too: License check:
Travis integration:
|
Seems like it's easy enough to get a redis server by editing the |
93ee603
to
58aa9eb
Compare
Codecov Report
@@ Coverage Diff @@
## master #1977 +/- ##
==========================================
+ Coverage 58.15% 58.23% +0.08%
==========================================
Files 114 115 +1
Lines 9678 9750 +72
==========================================
+ Hits 5628 5678 +50
- Misses 3553 3572 +19
- Partials 497 500 +3
Continue to review full report at Codecov.
|
@AlCutter - Thanks for the feedback! Pushed changes, and it looks like tests are all passing now, including those using the Redis server 🎉 |
@adunham-stripe Many thanks! Looking forward to seeing what else you might come up with :) |
@AlCutter - And thank you for the quick review! |
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package redistb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: You're missing a package comment here.
What
This pull request adds two new packages:
quota/redis/redistb
). The underlying Lua script is based on what Stripe uses for our internal rate-limiters, is atomic, can handles tens of thousands of requests per second with no trouble, and is easily scaled via Redis Cluster.quota.Manager
implementation that uses it (underquota/redis/redisqm
). This package is currently fairly basic; all configuration is performed via code, not stored in Redis or another datastore. Note that it doesn't acquire multiplequota.Spec
s transactionally, but rather in order. This should be easy to extend in the future, if necessary.Checklist