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

Smmoth_round_roubine:Performance improvement #836

Merged
merged 6 commits into from
Jan 10, 2024

Conversation

blight19
Copy link
Contributor

update smmoth_round_roubine

rewrite this part code.
when initional i calc the server's weight ,and then add them to a ring.
and then select the server ,only get it from ring.
benchmark
from

goos: linux
goarch: amd64
pkg: github.com/smallnest/rpcx/client
cpu: AMD Ryzen 5 3500U with Radeon Vega Mobile Gfx  
BenchmarkWeightedRoundRobinSelector_Select
BenchmarkWeightedRoundRobinSelector_Select-8   	52450845	         19.27 ns/op

to

goos: linux
goarch: amd64
pkg: github.com/smallnest/rpcx/client
cpu: AMD Ryzen 5 3500U with Radeon Vega Mobile Gfx  
BenchmarkWeightedRoundRobinSelector_Select
BenchmarkWeightedRoundRobinSelector_Select-8   	384278872	         3.044 ns/op

but i think it shuod add a rwlock, old code didn't use it .

@blight19
Copy link
Contributor Author

i add a s.buildRing() when call UpdateServer to fix it.

@smallnest smallnest merged commit af9bc96 into smallnest:master Jan 10, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants