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_limit.read to limit query rate #1158

Merged
merged 2 commits into from
Sep 2, 2020
Merged

Add rate_limit.read to limit query rate #1158

merged 2 commits into from
Sep 2, 2020

Conversation

Linary
Copy link
Contributor

@Linary Linary commented Aug 30, 2020

Change-Id: I6d620270937e425b417cbaaedd1d67dfb058791f

public static final ConfigOption<Integer> RATE_LIMIT_READ =
new ConfigOption<>(
"rate_limit.read",
"The max rate(times/s) to execute query.",
Copy link
Contributor

Choose a reason for hiding this comment

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

execute query of vertices/edges.

@codecov
Copy link

codecov bot commented Aug 30, 2020

Codecov Report

Merging #1158 into master will decrease coverage by 0.04%.
The diff coverage is 59.09%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1158      +/-   ##
============================================
- Coverage     65.35%   65.30%   -0.05%     
- Complexity     5632     5724      +92     
============================================
  Files           356      356              
  Lines         28874    29571     +697     
  Branches       4055     4170     +115     
============================================
+ Hits          18870    19311     +441     
- Misses         8118     8348     +230     
- Partials       1886     1912      +26     
Impacted Files Coverage Δ Complexity Δ
...com/baidu/hugegraph/auth/HugeFactoryAuthProxy.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...aidu/hugegraph/backend/tx/AbstractTransaction.java 73.24% <25.00%> (-2.76%) 53.00 <0.00> (ø)
...in/java/com/baidu/hugegraph/StandardHugeGraph.java 81.84% <77.77%> (+1.45%) 162.00 <0.00> (+50.00)
...n/java/com/baidu/hugegraph/config/CoreOptions.java 99.27% <100.00%> (+0.01%) 2.00 <0.00> (ø)
...va/com/baidu/hugegraph/backend/id/IdGenerator.java 72.93% <0.00%> (-8.58%) 37.00% <0.00%> (+17.00%) ⬇️
...va/com/baidu/hugegraph/task/ServerInfoManager.java 71.59% <0.00%> (-2.28%) 51.00% <0.00%> (-2.00%)
...e/src/main/java/com/baidu/hugegraph/HugeGraph.java 64.61% <0.00%> (-0.70%) 9.00% <0.00%> (ø%)
...c/main/java/com/baidu/hugegraph/task/HugeTask.java 69.84% <0.00%> (+0.30%) 82.00% <0.00%> (+1.00%)
...a/com/baidu/hugegraph/auth/HugeGraphAuthProxy.java 4.77% <0.00%> (+0.64%) 0.00% <0.00%> (ø%)
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b9cb6f7...9516a40. Read the comment docs.

zhoney
zhoney previously approved these changes Aug 30, 2020
Change-Id: I6d620270937e425b417cbaaedd1d67dfb058791f
// Do rate limit if needed
RateLimiter rateLimiter = this.graph.readRateLimiter();
if (rateLimiter != null && query.resultType().isGraph()) {
double time = rateLimiter.acquire(1);
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the behavior if it is interrupted

Change-Id: I035515137dba4c9314bbf66fb7e4c13f79ab448b
@zhoney zhoney merged commit 9babdae into master Sep 2, 2020
@zhoney zhoney deleted the read_rate_limiter branch September 2, 2020 17:17
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.

None yet

3 participants