Skip to content

executor: add slow-log file meta cache to avoid repeat read file meta information#21536

Closed
crazycs520 wants to merge 11 commits intopingcap:masterfrom
crazycs520:opt-slow-log-cache
Closed

executor: add slow-log file meta cache to avoid repeat read file meta information#21536
crazycs520 wants to merge 11 commits intopingcap:masterfrom
crazycs520:opt-slow-log-cache

Conversation

@crazycs520
Copy link
Copy Markdown
Contributor

What problem does this PR solve?

When there are many tidb-slow.log files, function getAllFiles will spend much time to read the start time and end time of the slow-log file. This PR adds a file meta cache to avoid resolve log file time.

Related PR: pingcap/sysutil#26

Here is a tiny benchmark when there are 1247 tidb_slow_query.log files.

Before this PR, getAllFiles function cost 16.3s.

This PR, after the first run time then the file meta was cached, then getAllFiles function only cost 23ms.

Related changes

  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test
  • Manual test

Side effects

  • Performance regression
    • Consumes more MEM

Release note

  • Add slow-log file meta cache to avoid repeat read file meta information.

crazycs520 and others added 8 commits December 3, 2020 11:18
Signed-off-by: crazycs520 <crazycs520@gmail.com>
Signed-off-by: crazycs520 <crazycs520@gmail.com>
Signed-off-by: crazycs520 <crazycs520@gmail.com>
Signed-off-by: crazycs520 <crazycs520@gmail.com>
Signed-off-by: crazycs520 <crazycs520@gmail.com>
Signed-off-by: crazycs520 <crazycs520@gmail.com>
@crazycs520 crazycs520 added type/enhancement The issue or PR belongs to an enhancement. component/executor labels Dec 7, 2020
@crazycs520 crazycs520 requested a review from a team as a code owner December 7, 2020 11:22
@crazycs520 crazycs520 requested review from XuHuaiyu and removed request for a team December 7, 2020 11:22
@github-actions github-actions bot added sig/sql-infra SIG: SQL Infra sig/execution SIG execution labels Dec 7, 2020
Signed-off-by: crazycs520 <crazycs520@gmail.com>
@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 22, 2021
@ti-chi-bot
Copy link
Copy Markdown
Member

@crazycs520: PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@XuHuaiyu XuHuaiyu removed their request for review June 25, 2021 06:25
@crazycs520 crazycs520 closed this Jun 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/executor needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. sig/execution SIG execution sig/sql-infra SIG: SQL Infra type/enhancement The issue or PR belongs to an enhancement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants