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

High read index duration #3555

Closed
flowbehappy opened this issue Nov 29, 2021 · 2 comments · Fixed by #3971
Closed

High read index duration #3555

flowbehappy opened this issue Nov 29, 2021 · 2 comments · Fixed by #3971
Assignees
Labels
type/enhancement The issue or PR belongs to an enhancement.

Comments

@flowbehappy
Copy link
Contributor

By hacking the code (doLearnerRead), I am able to eliminate the readIndex operation, to evaluate the cost of it. I run a simple SQL by different threads.

Benchmark SQL: select min(actual_disp_no) from A;
Single thread duration: 230ms
No updates during the benchmark.

  1. The more threads, the higher SQL execution duration.
  2. The more threads, the higher read index duration. The time spent on the cost of read index can be over 30%.
  3. TiFlash cannot fully utilize the CPU resources. only use up to 40% of 40 cores.

middle_img_v2_039f6194-b815-4f5a-bbd6-4a52ee1d01bg
middle_img_v2_9df57076-ef62-4734-b380-18bb722434fg
middle_img_v2_a199afc9-2fd8-47ae-86f5-d855251133eg

@flowbehappy flowbehappy added the type/enhancement The issue or PR belongs to an enhancement. label Nov 29, 2021
@solotzg
Copy link
Contributor

solotzg commented Nov 29, 2021

You can change such item to 81920 in tikv and proxy: https://docs.pingcap.com/tidb/stable/tikv-configuration-file#raft-client-queue-size.

image

image

@solotzg
Copy link
Contributor

solotzg commented Dec 2, 2021

There are a few ways to implement stale-read in tiflash.

pull mode:

  • start a loop with interval N_0, N_1, .. N_MAX seconds.
  • in each loop task, try to execute learner-read process and compute safe tso for all regions.
  • tidb should set start-ts to latest-tso - N sec for special stale-read query.
  • tiflash can check whether tso is safe to skip leader-read for queries.

push mode:

  • implement stale-read like follower-read process in tikv.
  • enable stale-read option in sql.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants