cloudflare / pingora

A library for building fast, reliable and evolvable network services.
Apache License 2.0
20.3k stars 1.1k forks source link

Implement least connection load balancing algorithm #144

Open Kevin301099 opened 3 months ago

beamandala commented 3 months ago

Hi, is this issue available to work on?

eaufavor commented 3 months ago

Our load balancing traits are public https://docs.rs/pingora-load-balancing/latest/pingora_load_balancing/selection/trait.BackendSelection.html.

@beamandala if you like to implement it, go for it. The code doesn't have to be in our libraries for people to use. Still, PRs are always welcomed.

beamandala commented 3 months ago

Thanks! Correct me if I'm wrong but if I wanted to make a pull request adding the least connection load balancing algorithm to pingora, I'm assuming I would have to follow a pattern similar to the weighted selection algorithm where I would add a connections field to the Backend struct and place the actual algorithm implementation in its own file?

eaufavor commented 3 months ago

add a connections field to the Backend struct

I imagine you will track the connection info in your own struct. like ketama.

I don't think the Backend itself needs to be changed.