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

store/copr: set low concurrency for keep order coprocessor requests #35975

Merged
merged 23 commits into from
Jul 17, 2022
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
e41d3c7
store/copr: set low concurrency for keep order coprocessor requests
tiancaiamao Jul 6, 2022
ad4c86a
update comment
tiancaiamao Jul 6, 2022
bc22e99
Merge branch 'master' into keep-order-concurrency
tiancaiamao Jul 6, 2022
92e87cc
Merge branch 'master' into keep-order-concurrency
tiancaiamao Jul 6, 2022
d5ffeb1
address comment
tiancaiamao Jul 6, 2022
8f6ab49
Merge branch 'master' into keep-order-concurrency
hawkingrei Jul 8, 2022
f71947b
Merge branch 'master' into keep-order-concurrency
ti-chi-bot Jul 14, 2022
855fadc
Merge branch 'master' into keep-order-concurrency
ti-chi-bot Jul 14, 2022
1a3e2eb
Merge branch 'master' into keep-order-concurrency
tiancaiamao Jul 14, 2022
cee1157
Merge branch 'master' into keep-order-concurrency
ti-chi-bot Jul 14, 2022
a4f9324
Merge branch 'master' into keep-order-concurrency
ti-chi-bot Jul 14, 2022
4dbdd09
Merge branch 'master' into keep-order-concurrency
ti-chi-bot Jul 14, 2022
41a1fc5
Merge branch 'master' into keep-order-concurrency
ti-chi-bot Jul 14, 2022
f459de7
Merge branch 'master' into keep-order-concurrency
ti-chi-bot Jul 14, 2022
fff5335
Merge branch 'master' into keep-order-concurrency
ti-chi-bot Jul 14, 2022
738356b
Merge branch 'master' into keep-order-concurrency
ti-chi-bot Jul 14, 2022
150f37a
Merge branch 'master' into keep-order-concurrency
ti-chi-bot Jul 14, 2022
31f5890
Merge branch 'master' into keep-order-concurrency
ti-chi-bot Jul 14, 2022
94c61cb
Merge branch 'master' into keep-order-concurrency
tiancaiamao Jul 15, 2022
de723b5
Merge branch 'master' into keep-order-concurrency
tiancaiamao Jul 15, 2022
ae28d7c
Merge branch 'master' into keep-order-concurrency
tiancaiamao Jul 15, 2022
4f753fe
fix CI
tiancaiamao Jul 17, 2022
74edaeb
Merge branch 'master' into keep-order-concurrency
tiancaiamao Jul 17, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions store/copr/coprocessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,23 @@ func (c *CopClient) Send(ctx context.Context, req *kv.Request, variables interfa
}

if it.req.KeepOrder {
// Don't set high concurrency for the keep order case. It wastes a lot of memory and gains nothing.
// TL;DR
// Because for a keep order coprocessor request, the cop tasks are handled one by one, if we set a
// higher concurrency, the data is just cached and not consumed for a while, this increase the memory usage.
// Set concurrency to 2 can reduce the memory usage and I've tested that it does not necessarily
// decrease the performance.
if it.concurrency > 2 {
oldConcurrency := it.concurrency
it.concurrency = 2

failpoint.Inject("testRateLimitActionMockConsumeAndAssert", func(val failpoint.Value) {
if val.(bool) {
// When the concurrency is too small, test case tests/realtikvtest/sessiontest.TestCoprocessorOOMAction can't trigger OOM condition
it.concurrency = oldConcurrency
}
})
}
it.sendRate = util.NewRateLimit(2 * it.concurrency)
it.respChan = nil
} else {
Expand Down