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

*: reduce the store clone #1410

Merged
merged 6 commits into from Jan 30, 2019

Conversation

@rleungx
Copy link
Member

commented Jan 14, 2019

What problem does this PR solve?

When there are lots of stores, GetStores will cost a lot of time due to Clone.

What is changed and how it works?

This PR tries to reduce the store clone when using GetStore and GetStores.

Check List

Tests

  • Unit test

@rleungx rleungx requested a review from nolouch Jan 14, 2019

@nolouch
Copy link
Member

left a comment

Can you share the benchmark result?

@disksing
Copy link
Member

left a comment

the rest LGTM

Show resolved Hide resolved server/core/store.go Outdated
Show resolved Hide resolved server/core/store.go Outdated

@rleungx rleungx force-pushed the rleungx:reduce-store-clone branch from 9aa1f73 to ea9a0bb Jan 17, 2019

@codecov-io

This comment has been minimized.

Copy link

commented Jan 17, 2019

Codecov Report

❗️ No coverage uploaded for pull request base (master@8d6c936). Click here to learn what that means.
The diff coverage is 90.2%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1410   +/-   ##
=========================================
  Coverage          ?   67.81%           
=========================================
  Files             ?      158           
  Lines             ?    14986           
  Branches          ?        0           
=========================================
  Hits              ?    10163           
  Misses            ?     3901           
  Partials          ?      922
Impacted Files Coverage Δ
server/schedulers/balance_leader.go 91.39% <100%> (ø)
server/grpc_service.go 53.65% <100%> (ø)
server/schedule/replica.go 100% <100%> (ø)
server/schedule/range_cluster.go 87.5% <100%> (ø)
server/schedulers/random_merge.go 65.78% <100%> (ø)
server/core/kv.go 76.47% <100%> (ø)
server/api/trend.go 68.75% <100%> (ø)
server/schedule/operator.go 89.12% <100%> (ø)
server/schedulers/label.go 82.6% <100%> (ø)
server/api/store.go 64.9% <100%> (ø)
... and 22 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8d6c936...1ab3205. Read the comment docs.

@rleungx rleungx force-pushed the rleungx:reduce-store-clone branch from ea9a0bb to 11bb9b7 Jan 17, 2019

@pingcap pingcap deleted a comment from nolouch Jan 17, 2019

@rleungx rleungx added the DNM label Jan 18, 2019

@nolouch
Copy link
Member

left a comment

LGTM

@rleungx rleungx force-pushed the rleungx:reduce-store-clone branch from 3f6e2b2 to 01984c1 Jan 24, 2019

@rleungx

This comment has been minimized.

Copy link
Member Author

commented Jan 24, 2019

Here are the benchmark results:

before:
PASS: cluster_test.go:597: testGetStoresSuite.BenchmarkGetStores	    5000	    695042 ns/op
after:
PASS: cluster_test.go:597: testGetStoresSuite.BenchmarkGetStores	  500000	      4624 ns/op

PTAL @disksing @nolouch @siddontang

@huachaohuang

This comment has been minimized.

Copy link
Contributor

commented Jan 26, 2019

/rebuild

rleungx added some commits Jan 11, 2019

reduce store clone
Signed-off-by: rleungx <rleungx@gmail.com>
address comments
Signed-off-by: rleungx <rleungx@gmail.com>
tiny fixs
Signed-off-by: rleungx <rleungx@gmail.com>
add the benchmark
Signed-off-by: rleungx <rleungx@gmail.com>
tiny clean up
Signed-off-by: rleungx <rleungx@gmail.com>

@rleungx rleungx force-pushed the rleungx:reduce-store-clone branch from 63fdd4b to 1ab3205 Jan 28, 2019

@rleungx rleungx removed the DNM label Jan 28, 2019

@huachaohuang

This comment has been minimized.

Copy link
Contributor

commented Jan 30, 2019

The result looks awesome, but please fix the CI.

@rleungx

This comment has been minimized.

Copy link
Member Author

commented Jan 30, 2019

/rebuild

@rleungx

This comment has been minimized.

Copy link
Member Author

commented Jan 30, 2019

The CI problem is not related to this PR. @huachaohuang

@nolouch

This comment has been minimized.

Copy link
Member

commented Jan 30, 2019

/rebuild

@huachaohuang huachaohuang merged commit 9db4a56 into pingcap:master Jan 30, 2019

4 checks passed

ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
idc-jenkins-ci/build Jenkins job succeeded.
Details
license/cla Contributor License Agreement is signed.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.