pingcap / tidb

TiDB - the open-source, cloud-native, distributed SQL database designed for modern applications.
https://pingcap.com
Apache License 2.0
37.37k stars 5.86k forks source link

store/copr: remove useless ticker for performance #57558

Closed crazycs520 closed 4 days ago

crazycs520 commented 5 days ago

What problem does this PR solve?

Issue Number: ref #57580

Problem Summary: remove useless ticker for performance

What changed and how does it work?

This pr removes this useless ticker. In current implementation, if the SQL is been killed, then ctx.Done will work, so no need the ticker.

And remove it is for performance, following is the sysbench oltp_index_scan test, and the range size is 2:

sysbench --config-file=sysbench.conf oltp_index_scan --tables=16 --table-size=1000000 --threads=128 --range-size=2 run

The example query is like this:

SELECT
  k
FROM
  sbtest1
WHERE
  k BETWEEN ?
  AND ? [arguments: (503925, 503926)]

Which Plan is:


| id                 | estRows | estCost | actRows | task      | access object               | execution info                                                                                                                                                                                                                                                                                         | operator info                           | memory    | disk  |
| IndexReader_6      | 2.07    | 31.20   | 2       | root      |                             | time:1.31ms, loops:2, cop_task: {num: 1, max: 1.15ms, proc_keys: 2, tot_proc: 81.2µs, tot_wait: 575.8µs, copr_cache: disabled, build_task_duration: 12.2µs, max_distsql_concurrency: 1}, rpc_info:{Cop:{num_rpc:1, total_time:1.12ms}}                                                                 | index:IndexRangeScan_5                  | 278 Bytes | N/A   |
| └─IndexRangeScan_5 | 2.07    | 336.86  | 2       | cop[tikv] | table:sbtest1, index:k_1(k) | tikv_task:{time:0s, loops:1}, scan_detail: {total_process_keys: 2, total_process_keys_size: 92, total_keys: 3, get_snapshot_time: 539.6µs, rocksdb: {key_skipped_count: 2, block: {cache_hit_count: 6}}}, time_detail: {total_process_time: 81.2µs, total_wait_time: 575.8µs, tikv_wall_time: 751.3µs} | range:[503925,503926], keep order:false | N/A       | N/A   |
Version workload sub-cmd Thread QPS AVG Duration QPS Increase
Master Sysbench oltp_index_scan 128 80285 1.59 0%
This PR Sysbench oltp_index_scan 128 82009 1.56 2.1%

Check List

Tests

Side effects

Documentation

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None
tiprow[bot] commented 5 days ago

Hi @crazycs520. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
codecov[bot] commented 5 days ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 73.4613%. Comparing base (2ff351d) to head (d5faf48). Report is 12 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #57558 +/- ## ================================================ + Coverage 72.8166% 73.4613% +0.6447% ================================================ Files 1676 1676 Lines 463603 463630 +27 ================================================ + Hits 337580 340589 +3009 + Misses 105179 102293 -2886 + Partials 20844 20748 -96 ``` | [Flag](https://app.codecov.io/gh/pingcap/tidb/pull/57558/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pingcap) | Coverage Δ | | |---|---|---| | [integration](https://app.codecov.io/gh/pingcap/tidb/pull/57558/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pingcap) | `43.4779% <ø> (?)` | | | [unit](https://app.codecov.io/gh/pingcap/tidb/pull/57558/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pingcap) | `72.2713% <ø> (+0.0636%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pingcap#carryforward-flags-in-the-pull-request-comment) to find out more. | [Components](https://app.codecov.io/gh/pingcap/tidb/pull/57558/components?src=pr&el=components&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pingcap) | Coverage Δ | | |---|---|---| | [dumpling](https://app.codecov.io/gh/pingcap/tidb/pull/57558/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pingcap) | `52.7673% <ø> (ø)` | | | [parser](https://app.codecov.io/gh/pingcap/tidb/pull/57558/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pingcap) | `∅ <ø> (∅)` | | | [br](https://app.codecov.io/gh/pingcap/tidb/pull/57558/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pingcap) | `45.4049% <ø> (+0.0060%)` | :arrow_up: |

🚨 Try these New Features:

crazycs520 commented 5 days ago

/retest-required

tiprow[bot] commented 5 days ago

@crazycs520: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to [this](https://github.com/pingcap/tidb/pull/57558#issuecomment-2488553401): >/retest-required Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
ti-chi-bot[bot] commented 4 days ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tiancaiamao, zyguan

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

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/pingcap/tidb/blob/master/OWNERS)~~ [tiancaiamao,zyguan] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
ti-chi-bot[bot] commented 4 days ago

[LGTM Timeline notifier]

Timeline: