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

raftstore: remove nested loop replica read queue #6396

Merged
merged 28 commits into from Jan 9, 2020

Conversation

hicqu
Copy link
Contributor

@hicqu hicqu commented Jan 2, 2020

Signed-off-by: qupeng qupeng@pingcap.com

What have you changed?

Avoid to use nested loop in replica read queue to improve performance, and simplify algorithm.
Close #6399 .

What is the type of the changes?

Engeering.

How is the PR tested?

Unit tests.

Does this PR affect documentation (docs) or should it be mentioned in the release notes?

No.

Does this PR affect tidb-ansible?

No.

Refer to a related PR or issue link (optional)

Benchmark result if necessary (optional)

For using HashMap::get to replace Vec::get, benchmark shows that if the element count is greater than 9, HashMap will be better. So the change is reasonable. And removing nested for loop will make it better.

Any examples? (optional)

Signed-off-by: qupeng <qupeng@pingcap.com>
@hicqu
Copy link
Contributor Author

hicqu commented Jan 2, 2020

/run-all-tests

@hicqu
Copy link
Contributor Author

hicqu commented Jan 2, 2020

/bench

Signed-off-by: qupeng <qupeng@pingcap.com>
Signed-off-by: qupeng <qupeng@pingcap.com>
@hicqu
Copy link
Contributor Author

hicqu commented Jan 2, 2020

/bench

Signed-off-by: qupeng <qupeng@pingcap.com>
@hicqu
Copy link
Contributor Author

hicqu commented Jan 3, 2020

/run-all-tests

@hicqu hicqu added priority/high Priority: High type/enhancement Type: Issue - Enhancement priority/release-blocker This PR blocks a release. Please review it ASAP. needs-cherry-pick-release-3.1 Type: Need cherry pick to release 3.1 labels Jan 3, 2020
@hicqu
Copy link
Contributor Author

hicqu commented Jan 3, 2020

/run-all-tests

src/raftstore/store/peer.rs Outdated Show resolved Hide resolved
src/raftstore/store/peer.rs Outdated Show resolved Hide resolved
src/raftstore/store/peer.rs Outdated Show resolved Hide resolved
Signed-off-by: qupeng <qupeng@pingcap.com>
@hicqu
Copy link
Contributor Author

hicqu commented Jan 3, 2020

/run-all-tests

@hicqu
Copy link
Contributor Author

hicqu commented Jan 3, 2020

/bench

src/raftstore/store/peer.rs Outdated Show resolved Hide resolved
src/raftstore/store/peer.rs Outdated Show resolved Hide resolved
Signed-off-by: qupeng <qupeng@pingcap.com>
@sre-bot
Copy link
Contributor

sre-bot commented Jan 3, 2020

Benchmark Report

Run Sysbench Performance Test on VMs

@@                               Benchmark Diff                               @@
================================================================================
tidb: d07728468f31e228d3c0e2c3506e766c509179c9
--- tikv: 535ac80b66050c3d624838719cc65fe850ee5f9e
+++ tikv: dc310d139781b246d126a21e68c2087e317dd360
pd: 0ebe3f829ca87227862edb66d83b6c76100a0967
================================================================================
oltp_update_index:
    * QPS: 4250.43 ± 0.48% (std=13.77) delta: -0.28% (p=0.281)
    * Latency p50: 30.11 ± 0.48% (std=0.10) delta: 0.29%
    * Latency p99: 53.62 ± 4.09% (std=1.44) delta: 3.24%
            
oltp_insert:
    * QPS: 7540.31 ± 0.67% (std=33.42) delta: -0.26% (p=0.674)
    * Latency p50: 16.97 ± 0.66% (std=0.07) delta: 0.24%
    * Latency p99: 29.47 ± 4.56% (std=0.89) delta: 0.95%
            
oltp_read_write:
    * QPS: 15838.44 ± 0.31% (std=33.17) delta: 0.28% (p=0.407)
    * Latency p50: 162.00 ± 0.32% (std=0.34) delta: -0.24%
    * Latency p99: 327.55 ± 3.17% (std=7.68) delta: 3.53%
            
oltp_point_select:
    * QPS: 42924.78 ± 0.42% (std=125.15) delta: 0.00% (p=0.996)
    * Latency p50: 2.98 ± 0.22% (std=0.00) delta: -0.03%
    * Latency p99: 9.69 ± 3.12% (std=0.23) delta: -0.39%
            
oltp_update_non_index:
    * QPS: 4753.87 ± 0.04% (std=1.30) delta: 0.29% (p=0.375)
    * Latency p50: 26.92 ± 0.05% (std=0.01) delta: -0.29%
    * Latency p99: 40.37 ± 0.00% (std=0.00) delta: -3.58%
            

Signed-off-by: qupeng <qupeng@pingcap.com>
Signed-off-by: qupeng <qupeng@pingcap.com>
@hicqu
Copy link
Contributor Author

hicqu commented Jan 3, 2020

/run-all-tests

Signed-off-by: qupeng <qupeng@pingcap.com>
src/raftstore/store/read_queue.rs Outdated Show resolved Hide resolved
src/raftstore/store/read_queue.rs Outdated Show resolved Hide resolved
src/raftstore/store/read_queue.rs Outdated Show resolved Hide resolved
src/raftstore/store/peer.rs Show resolved Hide resolved
src/raftstore/store/peer.rs Show resolved Hide resolved
src/raftstore/store/peer.rs Outdated Show resolved Hide resolved
Signed-off-by: qupeng <qupeng@pingcap.com>
src/raftstore/store/read_queue.rs Outdated Show resolved Hide resolved
src/raftstore/store/peer.rs Outdated Show resolved Hide resolved
src/raftstore/store/read_queue.rs Outdated Show resolved Hide resolved
Signed-off-by: qupeng <qupeng@pingcap.com>
Signed-off-by: qupeng <qupeng@pingcap.com>
Signed-off-by: qupeng <qupeng@pingcap.com>
Signed-off-by: qupeng <qupeng@pingcap.com>
@hicqu hicqu added this to the v4.0.0-beta milestone Jan 9, 2020
@hicqu
Copy link
Contributor Author

hicqu commented Jan 9, 2020

/run-all-tests

@hicqu
Copy link
Contributor Author

hicqu commented Jan 9, 2020

/run-all-tests

1 similar comment
@hicqu
Copy link
Contributor Author

hicqu commented Jan 9, 2020

/run-all-tests

@hicqu
Copy link
Contributor Author

hicqu commented Jan 9, 2020

/run-all-tests

Signed-off-by: qupeng <qupeng@pingcap.com>
@hicqu hicqu merged commit 917c752 into tikv:master Jan 9, 2020
@hicqu hicqu deleted the read-index-improve branch January 9, 2020 08:55
@sre-bot
Copy link
Contributor

sre-bot commented Jan 9, 2020

cherry pick to release-3.1 failed

hicqu added a commit to hicqu/tikv that referenced this pull request Jan 9, 2020
Signed-off-by: qupeng <qupeng@pingcap.com>
solotzg pushed a commit to pingcap/tidb-engine-ext that referenced this pull request Feb 4, 2020
c1ay pushed a commit to c1ay/tikv that referenced this pull request May 9, 2020
Signed-off-by: qupeng <qupeng@pingcap.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-3.1 Type: Need cherry pick to release 3.1 priority/high Priority: High priority/release-blocker This PR blocks a release. Please review it ASAP. type/enhancement Type: Issue - Enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

follower read: improve read index queue
5 participants