Skip to content
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 rate limiting to control the number of requests per second #237

Merged
merged 4 commits into from
Nov 16, 2023

Conversation

YaacovHazan
Copy link
Collaborator

A new 'rate-limiting' option was added to control the number of request per second.

The rate limiting is based on the 'Token Bucket' algorithm, and according to the configured rate, on each interval, a "new" amount of requests allowed to be sent to the server.

The rate-limiting is at the connection level. Therefore, in cluster mode, the limitation is for each shard, so if, for example, the cluster has three shards and the user configured one request per second. On every second, memtier-benchmark will send three requests, one for each shard.

A new 'rate-limiting' option was added to control the number of
request per second.

The rate limiting is based on the 'Token Bucket' algorithm, and
according to the configured rate, on each interval, a "new" amount
of requests allowed to be sent to the server.

The rate-limiting is at the connection level. Therefore, in cluster mode,
the limitation is for each shard, so if, for example, the cluster has three
shards and the user configured one request per second. On every second,
memtier-benchmark will send three requests, one for each shard.
@codecov
Copy link

codecov bot commented Oct 15, 2023

Codecov Report

Attention: 24 lines in your changes are missing coverage. Please review.

Comparison is base (bec3471) 56.41% compared to head (cbb0bea) 56.20%.
Report is 1 commits behind head on master.

❗ Current head cbb0bea differs from pull request most recent head 7d2520c. Consider uploading reports for the commit 7d2520c to get more accurate results

Files Patch % Lines
shard_connection.cpp 26.31% 14 Missing ⚠️
memtier_benchmark.cpp 28.57% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #237      +/-   ##
==========================================
- Coverage   56.41%   56.20%   -0.21%     
==========================================
  Files          21       21              
  Lines        4359     4389      +30     
==========================================
+ Hits         2459     2467       +8     
- Misses       1900     1922      +22     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@filipecosta90 filipecosta90 linked an issue Oct 18, 2023 that may be closed by this pull request
Copy link
Collaborator

@filipecosta90 filipecosta90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM @YaacovHazan . I've tested this manually over the last days and I've also included tests for testing the rate-limiting expected request count.

@filipecosta90 filipecosta90 merged commit 9ddfcff into RedisLabs:master Nov 16, 2023
4 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] traffic rate limit
2 participants