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

release-21.1: tenantrate: switch to a single token bucket #65347

Conversation

RaduBerinde
Copy link
Member

@RaduBerinde RaduBerinde commented May 17, 2021

Backport:

Please see individual PRs for details.

/cc @cockroachdb/release

@RaduBerinde RaduBerinde requested a review from ajwerner May 17, 2021 18:45
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained

RaduBerinde and others added 5 commits May 24, 2021 10:12
This change adds a "test" facility which takes the description of a
uniform workload (read percentage, read size, write size) and prints
out an estimation of the sustained IOPS and burst IO. This will allow
a better understanding of how changes to the settings or the mechanism
translate into IOPS changes.

Release note: None
The `Merge` method was clunky and required type switched. Instead, the API
is changed to take a closure. Amazingly none of these closures escape!

Release note: None
This commit extracts the token bucket accounting logic into a
separate, public type. The same code will be used by the tenantrate
limiter.

Release note: None
Tenant rate limiting currently uses four separate token buckets, each
with its own rate and burst limits. In this commit we switch to a
single shared token bucket (see cockroachdb#55114 for motivation).

We use a "cost model" to map read and write requests to "KV Compute
Units". Requests have a base cost plus a per-byte cost. The details
are documented in settings.go. The values were chosen based on
experiments ran by Nathan:
https://docs.google.com/spreadsheets/d/1PPlIcKnusOqWtBoOZVd9xBEMPe5Ss1FgrJlYFgpQZaM/edit#gid=735409177

The rate was chosen so that it maps to 20% of 1 KV vCPU. This keeps
the rate limit on small requests roughly the same as before
(especially on mixed workloads).

The largest departure from the previous limits is that we allow much
more read bytes (the per-byte cost of reads is small in the cost
model). If we were to keep close to the previous limits, the value of
kv.tenant_rate_limiter.read_cost_per_megabyte would be 200 instead of
10.  Perhaps we want to be more conservative here and make this
value somewhere in-between?

Fixes cockroachdb#55114.

Release note: None
The way the test interacts with the configuration (through cluster
settings) is flaky - when we modify multiple settings and the head of
the queue gets notified, it might or might not observe the
intermediary state.

This commit cleans things up: the test now directly updates the config
rather than going through the cluster settings.

Fixes cockroachdb#63621.

Release note: None
@RaduBerinde RaduBerinde force-pushed the backport21.1-62814-63227-62783 branch from 7b08132 to f6b620d Compare May 24, 2021 17:12
@RaduBerinde RaduBerinde merged commit 6ba4f08 into cockroachdb:release-21.1 May 25, 2021
@RaduBerinde RaduBerinde deleted the backport21.1-62814-63227-62783 branch May 25, 2021 17:31
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.

3 participants