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

ddl: compared with v6.6.0, v7.0.0 has 10% - 13% performance regression #42456

Closed
Yui-Song opened this issue Mar 22, 2023 · 1 comment · Fixed by #42780 or #43123
Closed

ddl: compared with v6.6.0, v7.0.0 has 10% - 13% performance regression #42456

Yui-Song opened this issue Mar 22, 2023 · 1 comment · Fixed by #42780 or #43123
Assignees
Labels

Comments

@Yui-Song
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

  1. deploy a TiDB cluster and restore the data of ossinsight workload
  2. add index alter table github_events add index test_idx(repo_id,type,action,closed_at,actor_login)

2. What did you expect to see? (Required)

No performance regression

3. What did you see instead (Required)

image

4. What is your TiDB version? (Required)

v7.0.0

@ti-chi-bot ti-chi-bot added may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 labels Mar 22, 2023
@Yui-Song Yui-Song removed may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-6.1 may-affects-6.5 labels Mar 22, 2023
@jebter jebter added the sig/sql-infra SIG: SQL Infra label Mar 22, 2023
@tiancaiamao tiancaiamao assigned zimulala and tangenta and unassigned zimulala Mar 23, 2023
@lance6716 lance6716 assigned lance6716 and unassigned tangenta Mar 31, 2023
@lance6716
Copy link
Contributor

lance6716 commented Mar 31, 2023

The root cause is

after #40692 , I moved "generating job" logic into the single thread producer, and in each round, after all job is generated we send them to consumer

newJobs, err := local.prepareAndGenerateUnfinishedJob(
ctx,
engineUUID,
lf,
regionRanges,
regionSplitSize,
regionSplitKeys,
)
if err != nil {
close(jobToWorkerCh)
_ = workGroup.Wait()
return err
}
pendingJobs = append(pendingJobs, newJobs...)
if len(pendingJobs) == 0 {
break
}
jobWg.Add(len(pendingJobs))
for _, job := range pendingJobs {
select {
case <-workerCtx.Done():
err2 := retryErr.Load()
if err2 != nil {
return errors.Trace(err2)
}
return errors.Trace(workGroup.Wait())
case jobToWorkerCh <- job:

however, in old code generating job is scattered in multiple worker that runs concurrently

The CPU profile can locate this problem. in timestamp 1680237360
image

3 minutes later:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
6 participants