-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
kv: split rate limits and metrics for read and write requests #53510
kv: split rate limits and metrics for read and write requests #53510
Conversation
This makes the code cleaner and avoids the `ba.IsWrite()` call for read-only requests.
434d6de
to
3bcec6c
Compare
This commit splits the existing request rate limit into two categories, read requests and write requests. Experimentation has shown that the fixed cost of a request is dramatically different between these two categories, primarily because write requests need to go through Raft while read requests do not. By splitting the limits and metrics along this dimension, we expect to be able to more accurately model the cost of KV traffic and more effectively tune rate limits. In making the split, the commit replaces the existing metric: ``` kv.tenant_rate_limit.requests_admitted ``` with the following two new metrics: ``` kv.tenant_rate_limit.read_requests_admitted kv.tenant_rate_limit.write_requests_admitted ``` The commit also replaced the existing two settings: ``` kv.tenant_rate_limiter.requests.rate_limit kv.tenant_rate_limiter.request.burst_limit ``` with the following four new settings: ``` kv.tenant_rate_limiter.read_requests.rate_limit kv.tenant_rate_limiter.read_requests.burst_limit kv.tenant_rate_limiter.write_requests.rate_limit kv.tenant_rate_limiter.write_requests.burst_limit ``` Release justification: Low-risk, high benefit change.
3bcec6c
to
4c9110f
Compare
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.
Reviewed 1 of 1 files at r1, 15 of 15 files at r2.
Reviewable status: complete! 1 of 0 LGTMs obtained
TFTR! bors r+ |
Build failed: |
PR description was missing release justification. bors r+ |
Build failed (retrying...): |
Build failed (retrying...): |
This PR was included in a batch that was canceled, it will be automatically retried |
Build succeeded: |
This test was broken in cockroachdb#53510 which augmented the limiter machinery to deal with read and write requests independently. The problem is that the timer machinery works to synchronize the first blocked request but not subsequent requests. That leaves the test-writer with no fundamental means to ensure that subsequent blocked commands synchronize with a metrics command. This lack of synchronization on metrics was a pain-point when writing the original tests and led to excessive use of timers as synchronization. Rather than trying to add excess synchronization, this commit just adds a succeeds soon around the metrics. This works well. Fixes cockroachdb#53590 Release justification: non-production code changes Release note: None
53661: kvserver/tenantrate: fix flakey test r=nvanbenschoten a=ajwerner This test was broken in #53510 which augmented the limiter machinery to deal with read and write requests independently. The problem is that the timer machinery works to synchronize the first blocked request but not subsequent requests. That leaves the test-writer with no fundamental means to ensure that subsequent blocked commands synchronize with a metrics command. This lack of synchronization on metrics was a pain-point when writing the original tests and led to excessive use of timers as synchronization. Rather than trying to add excess synchronization, this commit just adds a succeeds soon around the metrics. This works well. Fixes #53590 Release justification: non-production code changes Release note: None Co-authored-by: Andrew Werner <[email protected]>
Fixes #53483.
This commit splits the existing request rate limit into two categories, read requests and write requests. Experimentation has shown that the fixed cost of a request is dramatically different between these two categories, primarily because write requests need to go through Raft while read requests do not. By splitting the limits and metrics along this dimension, we expect to be able to more accurately model the cost of KV traffic and more effectively tune rate limits.
In making the split, the commit replaces the existing metric:
with the following two new metrics:
The commit also replaced the existing two settings:
with the following four new settings:
Release justification: Low-risk, high benefit change.