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
New Balancing algorithm (Peak) EWMA #1570
Comments
I didn't know about peak EWMA, and it may actually solve this old desire to automatically compute weights based on response time and load without creating an oscillator. But at first glance it seems to me that we don't need to create a new LB algo for this, but instead use this to constantly adjust weights so that it could be used with any LB algo (e.g. even consistent hash, thus allowing cache farms to smoothly adjust to the load). An in-depth lecture of the document is needed to get the whole picture, though. Thanks Alex! |
That's a quite good hint in case the rtt is not available. https://github.com/tower-rs/tower/blob/master/tower/src/load/peak_ewma.rs#L32
Let me write some questions for implementation here so that we have something like a brainstorming for the implementation phase.
Let me try to create a simple picture for the flow. flowchart TD;
subgraph backends [backend]
subgraph be_servers [servers]
direction LR
id3([Server 1]) -..- id4([Server N]);
end
subgraph requests [requests]
id3([Server 1])
id4([Server N]);
end
subgraph health [health_check]
id3([Server 1])
id4([Server N]);
end
requests --- |get rrt or duration and set weight| be_servers
health --- |get rrt or duration and set weight| be_servers
end
|
added bc_rtt with this commit 5529c99 |
Should this really be based on TCP-level RTT? I think the linkerd/finagle docs use "round-trip time" to mean "RPC round-trip time" so the time between: |
@jaroslawr Well you are right, there should be more the one factor for the algorithm to decide which server should be used as you can see on the picture. The TCP-level RTT is just one factor, but this feature was not in HAProxy so I contributed this feature 😃 . I think the #1977 is a per-requirement before the (Peak) EWMA algorithm could be implemented, but that's just my opinion. 🤷♂️ |
Your Feature Request
It would be nice to have a balancing Algorithm which uses the backend server round-trip time (RTT) for weighting of the backend servers.
There is the peak exponentially-weighted moving average (“peak EWMA”) algorithm which uses the RTT from health checks or normal requests to measure a "fast" backend.
Cite from https://twitter.github.io/finagle/guide/Clients.html#power-of-two-choices-p2c-peak-ewma
Here also the link of linkerd' description https://linkerd.io/2016/03/16/beyond-round-robin-load-balancing-for-latency/
As far as I know the haproxy code I think there will be several steps to implement this feature.
bc_rtt
orserver_rtt
similar tofc_rtt
https://github.com/haproxy/haproxy/blob/master/src/tcp_sample.c#L478rtt
to theserver struct
? or use the already created calc from https://github.com/haproxy/haproxy/blob/master/src/log.c#L2452 "%Td"tcp-check
that the rtt from the check request is set to the server.rtt
and requests in queue for the backend servers, I think this is the trickiest part.balance ewma
orbalance pwma
Any opinions on this?
What are you trying to do?
I try to keep the latency for the clients low even when some servers handle "slow" requests.
Output of
haproxy -vv
The text was updated successfully, but these errors were encountered: