-
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
TableReader consumes too much memory #16104
Comments
Another suspect, This channel will cache one response in memory without memory tracking, finally double the actual memory usage of |
It seems the Lines 195 to 207 in fdfeac7
And in Line 91 in fdfeac7
That's why |
TableReader does not to sum the memory size of all chunks, because it is a non-blocking operator, where each chuck is fetched from TiKV and is pulled by its parent operator. In fact, for each non-blocking operator, its max memory size = concurrency * size of each chunk. It is different for blocking operators, such as join, aggregation and sort. In TableReader, there are two points where memory usage is collected.
The large memory occupation should result from 1, that means there are many resided chunks when using high concurrency. So it is necessary to shrink the concurrency of the tablescan or enlarge the concurrency of its parent operator to consume more chunks of scan. |
fixed in #21168 |
Please edit this comment or add a new comment to complete the following informationNot a bug
Duplicate bug
BugNote: Make Sure that 'component', and 'severity' labels are added 1. Root Cause Analysis (RCA) (optional)2. Symptom (optional)3. All Trigger Conditions (optional)4. Workaround (optional)5. Affected versions6. Fixed versions |
Since @Yisaer has contributed a lot to sig-exec, according to sig-exec [roles-and-organization-management.md#promotion](https://github.com/pingcap/community/blob/master/special-interest-groups/sig-exec/roles-and-organization-management.md#from-reviewer-to-committer), we would like to promote him to our new committer, and his detailed contribution is shown below: 1. contribute [20+](https://github.com/pingcap/tidb/pulls?q=is%3Apr+author%3Ayisaer+label%3Astatus%2Fcan-merge+label%3Asig%2Fexecution) PRs to the executor, 2. support the [global memory tracker](pingcap/tidb#16777) (a medium task) 4. support the ratelimit action to solve the [table reader oom problem](pingcap/tidb#16104) (a hard task) 5. help other contributors and review [25+](https://github.com/pingcap/tidb/pulls?q=is%3Apr+reviewed-by%3Ayisaer+-author%3Ayisaer) PRs. Thanks for his contribution!!
Since @Yisaer has contributed a lot to sig-exec, according to sig-exec [roles-and-organization-management.md#promotion](https://github.com/pingcap/community/blob/master/special-interest-groups/sig-exec/roles-and-organization-management.md#from-reviewer-to-committer), we would like to promote him to our new committer, and his detailed contribution is shown below: 1. contribute [20+](https://github.com/pingcap/tidb/pulls?q=is%3Apr+author%3Ayisaer+label%3Astatus%2Fcan-merge+label%3Asig%2Fexecution) PRs to the executor, 2. support the [global memory tracker](pingcap/tidb#16777) (a medium task) 4. support the ratelimit action to solve the [table reader oom problem](pingcap/tidb#16104) (a hard task) 5. help other contributors and review [25+](https://github.com/pingcap/tidb/pulls?q=is%3Apr+reviewed-by%3Ayisaer+-author%3Ayisaer) PRs. Thanks for his contribution!!
Since @Yisaer has contributed a lot to sig-exec, according to sig-exec [roles-and-organization-management.md#promotion](https://github.com/pingcap/community/blob/master/special-interest-groups/sig-exec/roles-and-organization-management.md#from-reviewer-to-committer), we would like to promote him to our new committer, and his detailed contribution is shown below: 1. contribute [20+](https://github.com/pingcap/tidb/pulls?q=is%3Apr+author%3Ayisaer+label%3Astatus%2Fcan-merge+label%3Asig%2Fexecution) PRs to the executor, 2. support the [global memory tracker](pingcap/tidb#16777) (a medium task) 4. support the ratelimit action to solve the [table reader oom problem](pingcap/tidb#16104) (a hard task) 5. help other contributors and review [25+](https://github.com/pingcap/tidb/pulls?q=is%3Apr+reviewed-by%3Ayisaer+-author%3Ayisaer) PRs. Thanks for his contribution!!
Description
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. What did you do?
Run TPCH Q18,
TableReader_86
consumes 886MB memory.In TiDB v4.0, the default memory quota is 1GB, so we need reduce the memory consumption.
2. What did you expect to see?
3. What did you see instead?
4. What version of TiDB are you using? (
tidb-server -V
or runselect tidb_version();
on TiDB)SIG slack channel
#sig-exec
Score
Mentor
The text was updated successfully, but these errors were encountered: