Skip to content

Conversation

dongjiang1989
Copy link
Contributor

@dongjiang1989 dongjiang1989 commented Aug 30, 2023

/kind feature

An O(1) time and O(n) memory weighted load balancing implementation

interleaved weighted round-robin(iwrr): https://en.wikipedia.org/wiki/Weighted_round_robin#Interleaved_WRR

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>
@dongjiang1989 dongjiang1989 changed the title dongjiang, add interleaved weighted roundrobin loadbalance feat: interleaved weighted round-robin load balance Aug 30, 2023
@codecov-commenter
Copy link

codecov-commenter commented Aug 30, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (8c3057f) 46.79% compared to head (8c3057f) 46.79%.

❗ Current head 8c3057f differs from pull request most recent head 3ea9f56. Consider uploading reports for the commit 3ea9f56 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2405   +/-   ##
=======================================
  Coverage   46.79%   46.79%           
=======================================
  Files         317      317           
  Lines       22929    22929           
=======================================
  Hits        10730    10730           
  Misses      11157    11157           
  Partials     1042     1042           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>
@dongjiang1989
Copy link
Contributor Author

loadbalance benchmarks test.

goos: darwin
goarch: amd64
pkg: dubbo.apache.org/dubbo-go/v3/cluster/loadbalance
cpu: VirtualApple @ 2.50GHz
Benchmark_Roudrobin_Loadbalace-8                       	    6685	    165956 ns/op	   88100 B/op	    2555 allocs/op
Benchmark_Leastative_Loadbalace-8                      	    7554	    166090 ns/op	   81877 B/op	    2043 allocs/op
Benchmark_Consistenthashing_Loadbalace-8               	   55594	     21595 ns/op	    3425 B/op	     267 allocs/op
Benchmark_P2C_Loadbalace-8                             	 2525548	       467.7 ns/op	     456 B/op	      10 allocs/op
Benchmark_InterleavedWeightedRoundRobin_Loadbalace-8   	   19184	     63018 ns/op	   45296 B/op	    1027 allocs/op
Benchmark_Random_Loadbalace-8                          	   22238	     53121 ns/op	   38976 B/op	     767 allocs/op
PASS
ok  	dubbo.apache.org/dubbo-go/v3/cluster/loadbalance	9.925s

@dongjiang1989
Copy link
Contributor Author

/cc @chickenlj PTAL

Copy link
Contributor

@chickenlj chickenlj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@dongjiang1989
Copy link
Contributor Author

dongjiang1989 commented Nov 8, 2023

LGTM.

@chickenlj maybe this pr merge to master branch?

Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
1.7% 1.7% Duplication

Copy link
Member

@justxuewei justxuewei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm, thanks!

@justxuewei justxuewei merged commit 19d1da0 into apache:main Dec 29, 2023
@dongjiang1989 dongjiang1989 deleted the interleaved-WRR branch January 29, 2024 23:44
@jizhuozhi
Copy link

Hi, I'm glad to see that dubbo-go uses the iwrr load balancing algorithm.

But I found that it is highly overlapped with the implementation I contributed in cloudwego/kitex#1019 (my original implementation). Following the apache 2.0 license, I hope to get copyright notice (with personal intentions), thank you.

@justxuewei
Copy link
Member

Sorry for inconvenience, I'll take care of this later today.

@chickenlj
Copy link
Contributor

Hi, I'm glad to see that dubbo-go uses the iwrr load balancing algorithm.

But I found that it is highly overlapped with the implementation I contributed in cloudwego/kitex#1019 (my original implementation). Following the apache 2.0 license, I hope to get copyright notice (with personal intentions), thank you.

We respect all creative inventions and copyrights. The contributor didn't mention that in the pull request, so we merged it based on the assumption that he is the code's original author.

I will revert this pull request now.

@jizhuozhi
Copy link

Hi, I'm glad to see that dubbo-go uses the iwrr load balancing algorithm.
But I found that it is highly overlapped with the implementation I contributed in cloudwego/kitex#1019 (my original implementation). Following the apache 2.0 license, I hope to get copyright notice (with personal intentions), thank you.

We respect all creative inventions and copyrights. The contributor didn't mention that in the pull request, so we merged it based on the assumption that he is the code's original author.

I will revert this pull request now.

Thanks, the later works (iwrr and alias method) will be assigned to @NX-Official, cc

justxuewei added a commit to justxuewei/dubbo-go that referenced this pull request Mar 4, 2024
NX-Official added a commit to NX-Official/dubbo-go that referenced this pull request Mar 4, 2024
FoghostCn pushed a commit to FoghostCn/dubbo-go that referenced this pull request Mar 27, 2024
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.

5 participants