-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Feature: implement p2c balancer with random, ewma, leastloaded #3211
Comments
If the performance is better, then welcome to submit PR. |
@hnlq715 A benchmark result is also desired to let us know the earnings :). |
Absolutely 😄 |
Simple benchmark result with 20 servers in upstream:
If the number of servers in upstream grows, the difference between p2cewma and ewma should be significant.
|
@hnlq715 Our ewma balancer is forked from an old version of its ewma implementation. Maybe we can replace our ewma with the p2cewma so that we are able to catch up with ingress-controller? |
@spacewander |
I think we should not use shared.DICT to store ewma data, to avoid using lock, which could improve performance significantly.
|
the performance is enough, welcome PR @hnlq715 |
My 2 cents: https://github.com/kubernetes/ingress-nginx/blob/master/rootfs/etc/nginx/lua/balancer/ewma.lua has always been configured to be p2c if you check the As to using shared dictionary, I've actually tried that in ingress-nginx: kubernetes/ingress-nginx#3295, and we ran with it for at least one version. But then I brought back the shared dictionary and locking in kubernetes/ingress-nginx#4448. In my company, we saw issues with 20 NGINX replicas and 1000 backends. Each NGINX replica with 40 workers. Without the shared dictionary we were seeing load balancing problems, the NGINX workers were taking too long to "know" that a backend is overloaded. |
@ElvinEfendi Thank you for sharing, it is very helpful. |
@ElvinEfendi Very insightful, thanks @moonming @membphis Maybe it's more wiser to use the shared dict to share data between worker processes, although with some performance lose. |
If i remember correctly, only Nginx Plus supports shared load balancing data among workers. I am also support to store data in shared memory, the performance loss should be acceptable. |
Nginx features are merged into open source version smoothly :-)
|
OK, My Nginx version is old :) |
Solved. Open another issue if you want to implement other p2c balancer. |
P2c implemention should have better performance than the implemention with for loop when the upstream contains lots of backend servers. apisix/balancer/ewma.lua
I would like to send a PR for this, if you guys interested.
The text was updated successfully, but these errors were encountered: