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

p-dml: resolve locks concurrently (#1584) #1585

Open
wants to merge 1 commit into
base: tidb-8.5
Choose a base branch
from

Conversation

you06
Copy link
Contributor

@you06 you06 commented Feb 19, 2025

Cherry pick #1584 to tidb-8.5 branch.


close #1577

The default range task size is too large for p-dml, which makes the concurrent resolve works bad, e.g., all the regions are pending in one worker and other workers are just waiting. Meanwhile, the utilization of TiKV CPU is low, and the resolve progress can take a long time.

defaultRegionsPerTask = 128

This PR set the task size to 1 for p-dml, so that the resolve progress can run at the concurrency given by user.

The resolve lock speed:

  • nightly: 44m21s
  • this PR: 14m19s

image

The progress logs work well with this change:

[2025/02/18 03:27:35.952 +00:00] [INFO] [range_task.go:167] ["range task started"] [name=pipelined-dml-commit-456090845481533442] [startKey=7480000000000000815f69800000000000000103800000000000000103800000000185fa98] [endKey=7480000000000000815f728000000005f5e100] [concurrency=8]
[2025/02/18 03:28:15.879 +00:00] [INFO] [range_task.go:209] ["range task in progress"] [name=pipelined-dml-commit-456090845481533442] [startKey=7480000000000000815f69800000000000000103800000000000000103800000000185fa98] [endKey=7480000000000000815f728000000005f5e100] [concurrency=8] ["cost time"=39.926761609s] ["completed regions"=8]
[2025/02/18 03:28:36.076 +00:00] [INFO] [range_task.go:209] ["range task in progress"] [name=pipelined-dml-commit-456090845481533442] [startKey=7480000000000000815f69800000000000000103800000000000000103800000000185fa98] [endKey=7480000000000000815f728000000005f5e100] [concurrency=8] ["cost time"=1m0.123584892s] ["completed regions"=14]
[2025/02/18 03:29:11.505 +00:00] [INFO] [range_task.go:209] ["range task in progress"] [name=pipelined-dml-commit-456090845481533442] [startKey=7480000000000000815f69800000000000000103800000000000000103800000000185fa98] [endKey=7480000000000000815f728000000005f5e100] [concurrency=8] ["cost time"=1m35.552227637s] ["completed regions"=25]
[2025/02/18 03:29:39.692 +00:00] [INFO] [range_task.go:209] ["range task in progress"] [name=pipelined-dml-commit-456090845481533442] [startKey=7480000000000000815f69800000000000000103800000000000000103800000000185fa98] [endKey=7480000000000000815f728000000005f5e100] [concurrency=8] ["cost time"=2m3.740022981s] ["completed regions"=35]
[2025/02/18 03:30:08.130 +00:00] [INFO] [range_task.go:209] ["range task in progress"] [name=pipelined-dml-commit-456090845481533442] [startKey=7480000000000000815f69800000000000000103800000000000000103800000000185fa98] [endKey=7480000000000000815f728000000005f5e100] [concurrency=8] ["cost time"=2m32.178047735s] ["completed regions"=44]
[2025/02/18 03:30:39.419 +00:00] [INFO] [range_task.go:209] ["range task in progress"] [name=pipelined-dml-commit-456090845481533442] [startKey=7480000000000000815f69800000000000000103800000000000000103800000000185fa98] [endKey=7480000000000000815f728000000005f5e100] [concurrency=8] ["cost time"=3m3.466146672s] ["completed regions"=55]
[2025/02/18 03:31:06.458 +00:00] [INFO] [range_task.go:209] ["range task in progress"] [name=pipelined-dml-commit-456090845481533442] [startKey=7480000000000000815f69800000000000000103800000000000000103800000000185fa98] [endKey=7480000000000000815f728000000005f5e100] [concurrency=8] ["cost time"=3m30.505386121s] ["completed regions"=64]
[2025/02/18 03:31:36.061 +00:00] [INFO] [range_task.go:209] ["range task in progress"] [name=pipelined-dml-commit-456090845481533442] [startKey=7480000000000000815f69800000000000000103800000000000000103800000000185fa98] [endKey=7480000000000000815f728000000005f5e100] [concurrency=8] ["cost time"=4m0.108660945s] ["completed regions"=74]
[2025/02/18 03:32:07.166 +00:00] [INFO] [range_task.go:209] ["range task in progress"] [name=pipelined-dml-commit-456090845481533442] [startKey=7480000000000000815f69800000000000000103800000000000000103800000000185fa98] [endKey=7480000000000000815f728000000005f5e100] [concurrency=8] ["cost time"=4m31.213248541s] ["completed regions"=84]
[2025/02/18 03:32:36.056 +00:00] [INFO] [range_task.go:209] ["range task in progress"] [name=pipelined-dml-commit-456090845481533442] [startKey=7480000000000000815f69800000000000000103800000000000000103800000000185fa98] [endKey=7480000000000000815f728000000005f5e100] [concurrency=8] ["cost time"=5m0.10354548s] ["completed regions"=96]
[2025/02/18 03:33:11.113 +00:00] [INFO] [range_task.go:209] ["range task in progress"] [name=pipelined-dml-commit-456090845481533442] [startKey=7480000000000000815f69800000000000000103800000000000000103800000000185fa98] [endKey=7480000000000000815f728000000005f5e100] [concurrency=8] ["cost time"=5m35.160928996s] ["completed regions"=102]
[2025/02/18 03:33:55.655 +00:00] [INFO] [range_task.go:209] ["range task in progress"] [name=pipelined-dml-commit-456090845481533442] [startKey=7480000000000000815f69800000000000000103800000000000000103800000000185fa98] [endKey=7480000000000000815f728000000005f5e100] [concurrency=8] ["cost time"=6m19.702216102s] ["completed regions"=110]
[2025/02/18 03:34:11.974 +00:00] [INFO] [range_task.go:209] ["range task in progress"] [name=pipelined-dml-commit-456090845481533442] [startKey=7480000000000000815f69800000000000000103800000000000000103800000000185fa98] [endKey=7480000000000000815f728000000005f5e100] [concurrency=8] ["cost time"=6m36.021730836s] ["completed regions"=114]
[2025/02/18 03:34:38.090 +00:00] [INFO] [range_task.go:209] ["range task in progress"] [name=pipelined-dml-commit-456090845481533442] [startKey=7480000000000000815f69800000000000000103800000000000000103800000000185fa98] [endKey=7480000000000000815f728000000005f5e100] [concurrency=8] ["cost time"=7m2.137833732s] ["completed regions"=118]
[2025/02/18 03:35:21.752 +00:00] [INFO] [range_task.go:209] ["range task in progress"] [name=pipelined-dml-commit-456090845481533442] [startKey=7480000000000000815f69800000000000000103800000000000000103800000000185fa98] [endKey=7480000000000000815f728000000005f5e100] [concurrency=8] ["cost time"=7m45.799917767s] ["completed regions"=126]
[2025/02/18 03:35:36.277 +00:00] [INFO] [range_task.go:209] ["range task in progress"] [name=pipelined-dml-commit-456090845481533442] [startKey=7480000000000000815f69800000000000000103800000000000000103800000000185fa98] [endKey=7480000000000000815f728000000005f5e100] [concurrency=8] ["cost time"=8m0.324446238s] ["completed regions"=130]
[2025/02/18 03:36:08.257 +00:00] [INFO] [range_task.go:209] ["range task in progress"] [name=pipelined-dml-commit-456090845481533442] [startKey=7480000000000000815f69800000000000000103800000000000000103800000000185fa98] [endKey=7480000000000000815f728000000005f5e100] [concurrency=8] ["cost time"=8m32.304513943s] ["completed regions"=135]
[2025/02/18 03:36:48.223 +00:00] [INFO] [range_task.go:209] ["range task in progress"] [name=pipelined-dml-commit-456090845481533442] [startKey=7480000000000000815f69800000000000000103800000000000000103800000000185fa98] [endKey=7480000000000000815f728000000005f5e100] [concurrency=8] ["cost time"=9m12.271027942s] ["completed regions"=142]
[2025/02/18 03:37:07.483 +00:00] [INFO] [range_task.go:209] ["range task in progress"] [name=pipelined-dml-commit-456090845481533442] [startKey=7480000000000000815f69800000000000000103800000000000000103800000000185fa98] [endKey=7480000000000000815f728000000005f5e100] [concurrency=8] ["cost time"=9m31.530321068s] ["completed regions"=149]
[2025/02/18 03:37:36.326 +00:00] [INFO] [range_task.go:209] ["range task in progress"] [name=pipelined-dml-commit-456090845481533442] [startKey=7480000000000000815f69800000000000000103800000000000000103800000000185fa98] [endKey=7480000000000000815f728000000005f5e100] [concurrency=8] ["cost time"=10m0.373384077s] ["completed regions"=151]
[2025/02/18 03:38:15.821 +00:00] [INFO] [range_task.go:209] ["range task in progress"] [name=pipelined-dml-commit-456090845481533442] [startKey=7480000000000000815f69800000000000000103800000000000000103800000000185fa98] [endKey=7480000000000000815f728000000005f5e100] [concurrency=8] ["cost time"=10m39.868249005s] ["completed regions"=158]
[2025/02/18 03:38:36.741 +00:00] [INFO] [range_task.go:209] ["range task in progress"] [name=pipelined-dml-commit-456090845481533442] [startKey=7480000000000000815f69800000000000000103800000000000000103800000000185fa98] [endKey=7480000000000000815f728000000005f5e100] [concurrency=8] ["cost time"=11m0.788590563s] ["completed regions"=165]
[2025/02/18 03:39:07.063 +00:00] [INFO] [range_task.go:209] ["range task in progress"] [name=pipelined-dml-commit-456090845481533442] [startKey=7480000000000000815f69800000000000000103800000000000000103800000000185fa98] [endKey=7480000000000000815f728000000005f5e100] [concurrency=8] ["cost time"=11m31.110917818s] ["completed regions"=169]
[2025/02/18 03:39:44.121 +00:00] [INFO] [range_task.go:209] ["range task in progress"] [name=pipelined-dml-commit-456090845481533442] [startKey=7480000000000000815f69800000000000000103800000000000000103800000000185fa98] [endKey=7480000000000000815f728000000005f5e100] [concurrency=8] ["cost time"=12m8.168255209s] ["completed regions"=174]
[2025/02/18 03:40:25.723 +00:00] [INFO] [range_task.go:209] ["range task in progress"] [name=pipelined-dml-commit-456090845481533442] [startKey=7480000000000000815f69800000000000000103800000000000000103800000000185fa98] [endKey=7480000000000000815f728000000005f5e100] [concurrency=8] ["cost time"=12m49.770345125s] ["completed regions"=182]
[2025/02/18 03:41:55.183 +00:00] [INFO] [range_task.go:276] ["range task finished"] [name=pipelined-dml-commit-456090845481533442] [startKey=7480000000000000815f69800000000000000103800000000000000103800000000185fa98] [endKey=7480000000000000815f728000000005f5e100] ["cost time"=14m19.230530045s] ["completed regions"=201]

@ti-chi-bot ti-chi-bot bot added dco-signoff: yes Indicates the PR's author has signed the dco. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 19, 2025
@cfzjywxk cfzjywxk requested a review from ekexium February 24, 2025 07:28
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Feb 25, 2025
Copy link

ti-chi-bot bot commented Feb 25, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-02-25 03:34:51.246616674 +0000 UTC m=+326839.199774926: ☑️ agreed by ekexium.

Copy link

ti-chi-bot bot commented Feb 25, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ekexium

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:

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 ti-chi-bot bot added the approved label Feb 25, 2025
@ekexium
Copy link
Contributor

ekexium commented Feb 25, 2025

Are we picking to v8.1 as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved dco-signoff: yes Indicates the PR's author has signed the dco. needs-1-more-lgtm Indicates a PR needs 1 more LGTM. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants