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

kvserver: the timeout of queued items should consider the rates of al… #83667

Merged
merged 1 commit into from
Jul 21, 2022

Conversation

shralex
Copy link
Contributor

@shralex shralex commented Jun 30, 2022

…l item types in the queue

When the kv.snapshot_recovery.max_rate and kv.snapshot_rebalance.max_rate
settings are given different values, if the recovery rate is high and the
rebalance rate is low, recovery snapshots can have a lower timeout than the
expected duration of a single rebalance snapshot. This means that any steady
rebalance load can starve recovery snapshots. To mitigate the issue, this PR
sets the timeout for a snapshot based on min(kv.snapshot_recovery.max_rate,
kv.snapshot_rebalance.max_rate).

Release note: None

@shralex shralex requested a review from a team as a code owner June 30, 2022 17:28
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@shralex shralex force-pushed the snapshot_timeout branch 2 times, most recently from 0ab4037 to 24649ef Compare June 30, 2022 17:56
Copy link
Member

@nvanbenschoten nvanbenschoten left a comment

Choose a reason for hiding this comment

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

Reviewed 5 of 5 files at r1, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @shralex)


pkg/kv/kvserver/queue_test.go line 996 at r1 (raw file):

			queueGuaranteedProcessingTimeBudget.Override(ctx, &st.SV, tc.guaranteedProcessingTime)
			recoverySnapshotRate.Override(ctx, &st.SV, tc.rateLimit)
			tf := makeRateLimitedTimeoutFunc(recoverySnapshotRate, rebalanceSnapshotRate)

Should we expand this test to exercise the case where the second rate limit is lower than the first?


pkg/kv/kvserver/queue_test.go line 996 at r1 (raw file):

			queueGuaranteedProcessingTimeBudget.Override(ctx, &st.SV, tc.guaranteedProcessingTime)
			recoverySnapshotRate.Override(ctx, &st.SV, tc.rateLimit)
			tf := makeRateLimitedTimeoutFunc(recoverySnapshotRate, rebalanceSnapshotRate)

We're not overriding the default of rebalanceSnapshotRate, so there's a potential that a change to the default value for rebalanceSnapshotRate will break the test. Let's override the setting with either a constant value or (even better) a value that varies between test cases so we can address the previous comment.

Copy link
Member

@nvanbenschoten nvanbenschoten left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @shralex)


-- commits line 2 at r2:
This commit message appears to have been doubled.

…l item types in the queue

When the kv.snapshot_recovery.max_rate and kv.snapshot_rebalance.max_rate
settings are given different values, if the recovery rate is high and the
rebalance rate is low, recovery snapshots can have a lower timeout than the
expected duration of a single rebalance snapshot. This means that any steady
rebalance load can starve recovery snapshots. To mitigate the issue, this PR
sets the timeout for a snapshot based on min(kv.snapshot_recovery.max_rate,
kv.snapshot_rebalance.max_rate).

Release note: None
@shralex
Copy link
Contributor Author

shralex commented Jul 21, 2022

bors r+

@craig
Copy link
Contributor

craig bot commented Jul 21, 2022

Build succeeded:

@craig craig bot merged commit c73adb1 into cockroachdb:master Jul 21, 2022
@nvanbenschoten
Copy link
Member

@shralex do we want to backport this to v21.2 and v22.1?

@shralex
Copy link
Contributor Author

shralex commented Sep 21, 2022

blathers backport 21.2

@shralex
Copy link
Contributor Author

shralex commented Sep 21, 2022

blathers backport 22.1

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.

kv: rebalance snapshots can starve recovery snapshots with asymmetric settings
3 participants