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

Add metric to record end to end time to pre-handle snapshot #3978

Merged
merged 14 commits into from
Mar 22, 2022

Conversation

CalvinNeo
Copy link
Member

@CalvinNeo CalvinNeo commented Feb 8, 2022

Signed-off-by: CalvinNeo [email protected]

What problem does this PR solve?

Issue Number: close #3759

Problem Summary:
We have no end to end metrics of prehandling snapshot, it may be hard to diagnostic some problems without this metrics.

What is changed and how it works?

Add a metrics recording end to end time of prehandling snapshot
image

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Add metric to record end to end time to pre-handle snapshot

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Feb 8, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • JaySon-Huang
  • jiaqizho

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@CalvinNeo CalvinNeo self-assigned this Feb 8, 2022
@ti-chi-bot ti-chi-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 8, 2022
@CalvinNeo CalvinNeo changed the title Add metric to record end to end time to pre-handle snapshot [WIP]Add metric to record end to end time to pre-handle snapshot Feb 8, 2022
@ti-chi-bot ti-chi-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 8, 2022
Signed-off-by: CalvinNeo <[email protected]>
@ti-chi-bot ti-chi-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 9, 2022
@CalvinNeo CalvinNeo changed the title [WIP]Add metric to record end to end time to pre-handle snapshot Add metric to record end to end time to pre-handle snapshot Feb 9, 2022
@ti-chi-bot ti-chi-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 9, 2022
@@ -297,6 +298,9 @@ std::vector<UInt64> KVStore::preHandleSSTsToDTFiles(
// Use failpoint to change the expected_block_size for some test cases
fiu_do_on(FailPoints::force_set_sst_to_dtfile_block_size, { expected_block_size = 3; });

Stopwatch watch;
SCOPE_EXIT({ GET_METRIC(tiflash_raft_command_duration_seconds, type_apply_snapshot_predecode_e2e).Observe(watch.elapsedSeconds()); });
Copy link
Contributor

@JaySon-Huang JaySon-Huang Feb 9, 2022

Choose a reason for hiding this comment

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

Maybe just use type_apply_snapshot_predecode in this line and remove ...
https://github.com/pingcap/tics/blob/b8f711014a9760efbd97eeac7e35bbd4403e1f9f/dbms/src/Storages/DeltaMerge/SSTFilesToDTFilesOutputStream.cpp#L82
... instead of adding a "e2e" panel?

/cc @flowbehappy

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it may be confusing, especially when we using this metrics, we need to first check the version, and then choose the way to interpret this metric.
Meanwhile, I think the original metric is also useful, since it records the consumed time other than schema builder, which I think is also worth recording.

Signed-off-by: CalvinNeo <[email protected]>
@CalvinNeo
Copy link
Member Author

CalvinNeo commented Feb 28, 2022

According to discussion, I change "Snapshot Predecode Duration" to record end to end time, and "Snapshot Predecode SST to DT Duration" to record SST -> DT time when using DT rather block method. /cc @JaySon-Huang @flowbehappy
image

@CalvinNeo
Copy link
Member Author

/run-all-tests

@sre-bot
Copy link
Collaborator

sre-bot commented Mar 1, 2022

Coverage for changed files

Filename                                                  Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Common/TiFlashMetrics.h                                        18                 0   100.00%          11                 0   100.00%          47                 1    97.87%           8                 0   100.00%
Storages/DeltaMerge/SSTFilesToDTFilesOutputStream.cpp          83                83     0.00%           8                 8     0.00%         148               148     0.00%          46                46     0.00%
Storages/Transaction/ApplySnapshot.cpp                        304               123    59.54%          13                 4    69.23%         471               214    54.56%         150                88    41.33%
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                         405               206    49.14%          32                12    62.50%         666               363    45.50%         204               134    34.31%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
16715      9481             43.28%    186706  95656        48.77%

full coverage report (for internal network access only)

Copy link
Contributor

@JaySon-Huang JaySon-Huang left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 2, 2022
Copy link
Contributor

@jiaqizho jiaqizho left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot removed the status/LGT1 Indicates that a PR has LGTM 1. label Mar 14, 2022
@ti-chi-bot ti-chi-bot added the status/LGT2 Indicates that a PR has LGTM 2. label Mar 14, 2022
@CalvinNeo
Copy link
Member Author

/merge

@ti-chi-bot
Copy link
Member

@CalvinNeo: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

You only need to trigger /merge once, and if the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

If you have any questions about the PR merge process, please refer to pr process.

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 ti-community-infra/tichi repository.

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 14, 2022
@sre-bot
Copy link
Collaborator

sre-bot commented Mar 14, 2022

Coverage for changed files

Filename                                                  Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Common/TiFlashMetrics.h                                        18                 0   100.00%          11                 0   100.00%          47                 1    97.87%           8                 0   100.00%
Flash/Mpp/MPPTunnel.h                                           8                 8     0.00%           8                 8     0.00%          14                14     0.00%           0                 0         -
Storages/DeltaMerge/SSTFilesToDTFilesOutputStream.cpp          83                83     0.00%           8                 8     0.00%         148               148     0.00%          46                46     0.00%
Storages/Transaction/ApplySnapshot.cpp                        304               123    59.54%          13                 4    69.23%         471               214    54.56%         150                88    41.33%
Storages/Transaction/SchemaBuilder.cpp                        835               794     4.91%          46                42     8.70%        1030               958     6.99%         488               468     4.10%
Storages/Transaction/SchemaGetter.h                             1                 1     0.00%           1                 1     0.00%           1                 1     0.00%           0                 0         -
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                        1249              1009    19.22%          87                63    27.59%        1711              1336    21.92%         692               602    13.01%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
16853      9456             43.89%    189609  95854        49.45%

full coverage report (for internal network access only)

@CalvinNeo
Copy link
Member Author

/merge

@ti-chi-bot
Copy link
Member

@CalvinNeo: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

You only need to trigger /merge once, and if the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

If you have any questions about the PR merge process, please refer to pr process.

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 ti-community-infra/tichi repository.

@CalvinNeo
Copy link
Member Author

/rebuild

@sre-bot
Copy link
Collaborator

sre-bot commented Mar 14, 2022

Coverage for changed files

Filename                                                  Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Common/TiFlashMetrics.h                                        18                 0   100.00%          11                 0   100.00%          47                 1    97.87%           8                 0   100.00%
Flash/Mpp/MPPTunnel.h                                           8                 8     0.00%           8                 8     0.00%          14                14     0.00%           0                 0         -
Storages/DeltaMerge/SSTFilesToDTFilesOutputStream.cpp          83                83     0.00%           8                 8     0.00%         148               148     0.00%          46                46     0.00%
Storages/Transaction/ApplySnapshot.cpp                        304               123    59.54%          13                 4    69.23%         471               214    54.56%         150                88    41.33%
Storages/Transaction/SchemaBuilder.cpp                        835               794     4.91%          46                42     8.70%        1030               958     6.99%         488               468     4.10%
Storages/Transaction/SchemaGetter.h                             1                 1     0.00%           1                 1     0.00%           1                 1     0.00%           0                 0         -
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                        1249              1009    19.22%          87                63    27.59%        1711              1336    21.92%         692               602    13.01%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
16853      9456             43.89%    189609  95875        49.44%

full coverage report (for internal network access only)

@JaySon-Huang
Copy link
Contributor

/merge cancel

@ti-chi-bot ti-chi-bot removed the status/can-merge Indicates a PR has been approved by a committer. label Mar 14, 2022
@JaySon-Huang
Copy link
Contributor

JaySon-Huang commented Mar 14, 2022

@CalvinNeo should pick this commit JaySon-Huang@58968b2 to fix the changes from #4099

@JaySon-Huang
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

@JaySon-Huang: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

You only need to trigger /merge once, and if the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

If you have any questions about the PR merge process, please refer to pr process.

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 ti-community-infra/tichi repository.

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 83e57ac

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 22, 2022
@sre-bot
Copy link
Collaborator

sre-bot commented Mar 22, 2022

Coverage for changed files

Filename                                                  Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Common/TiFlashMetrics.h                                        18                 0   100.00%          11                 0   100.00%          47                 1    97.87%           8                 0   100.00%
Storages/DeltaMerge/SSTFilesToDTFilesOutputStream.cpp          83                83     0.00%           8                 8     0.00%         148               148     0.00%          46                46     0.00%
Storages/Transaction/ApplySnapshot.cpp                        304               123    59.54%          13                 4    69.23%         471               214    54.56%         150                88    41.33%
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                         405               206    49.14%          32                12    62.50%         666               363    45.50%         204               134    34.31%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
17040      9576             43.80%    191887  97041        49.43%

full coverage report (for internal network access only)

@JaySon-Huang
Copy link
Contributor

/rebuild

@CalvinNeo
Copy link
Member Author

/run-integration-test

@ti-chi-bot
Copy link
Member

@CalvinNeo: Your PR was out of date, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

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 ti-community-infra/tichi repository.

@sre-bot
Copy link
Collaborator

sre-bot commented Mar 22, 2022

Coverage for changed files

Filename                                                  Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Common/TiFlashMetrics.h                                        18                 0   100.00%          11                 0   100.00%          47                 1    97.87%           8                 0   100.00%
Storages/DeltaMerge/SSTFilesToDTFilesOutputStream.cpp          83                83     0.00%           8                 8     0.00%         148               148     0.00%          46                46     0.00%
Storages/Transaction/ApplySnapshot.cpp                        304               123    59.54%          13                 4    69.23%         471               214    54.56%         150                88    41.33%
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                         405               206    49.14%          32                12    62.50%         666               363    45.50%         204               134    34.31%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
17040      9576             43.80%    191887  97040        49.43%

full coverage report (for internal network access only)

@ti-chi-bot ti-chi-bot merged commit 2b71569 into pingcap:master Mar 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The "Snapshot Predecode Duration" metric doesn't take syncSchema time in to account
5 participants