-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
statistics: avoid large CMSketch affecting the latency of normal query #17542
Conversation
No release note, Please follow https://github.com/pingcap/community/blob/master/contributors/release-note-checker.md |
/rebuild |
Codecov Report
@@ Coverage Diff @@
## master #17542 +/- ##
================================================
- Coverage 79.8510% 79.8279% -0.0232%
================================================
Files 520 520
Lines 140067 139743 -324
================================================
- Hits 111845 111554 -291
+ Misses 19275 19239 -36
- Partials 8947 8950 +3 |
good catch!!! |
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.
LGTM
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.
LGTM
/merge |
/run-all-tests |
/run-cherry-picker |
Signed-off-by: sre-bot <[email protected]>
cherry pick to release-3.0 in PR #17543 |
Signed-off-by: sre-bot <[email protected]>
cherry pick to release-3.1 in PR #17544 |
Signed-off-by: sre-bot <[email protected]>
cherry pick to release-4.0 in PR #17545 |
What problem does this PR solve?
Problem Summary:

We have captured a runtime trace of tidb-server and observed a large latency caused by GC sweep.
The root cause is the large amount 8K span referenced by
CMSketch
and there is a limitation of Go's allocator. In this case, 8K allocation issued byIndexLookUpExec
will take a long time to scan memory spans used byCMSketch
.What is changed and how it works?
Memory allocation larger than 32K will never use memory span. The default configuration of
CMSketch
will use 40K memory, so use a single slice is a workaround.This problem can be solved in Go 1.15, so this simple workaround is a good choice before Go 1.15 release.
This test is using v3.0.14 TiDB compiled with Go 1.13.10, but I believe v4.0 and Go 1.14 have the same problem.
Release note