As discovered here, there is new kind of kube service that are IPVS and have many algorithm for load balancing.
The only problem is I didn't find where those algorithm are specified.
My understanding:
rr
: round-robin -> call backend pod one after another in a looplc
: least connection -> group all pod with lowest number of connection, and send message to it. Which kind of connection ? only the ones from this service ?dh
: destination hashing -> ?something based on url?sh:
source hashing -> ?something based on url?sed
: shortest expected delay -> either the backend with less ping or some logic on the time a backend took to respond in the pastnq
: never queue -> same as least connection ? but refusing messages at some points ?If anyone has the documentation link (not provided in the official page and still saying IPVS is beta whereas it is stable sinc 1.11) or the real algorithm behind all of them, please help.
I tried : Google search with the terms + lookup in the official documentation.
They are defined in the code https://github.com/kubernetes/kubernetes/blob/master/pkg/proxy/apis/config/types.go#L193
rr
round robin : distributes jobs equally amongst the available real serverslc
least connection : assigns more jobs to real servers with fewer active jobssh
source hashing : assigns jobs to servers through looking up a statically assigned hash table by their source IP addressesdh
destination hashing : assigns jobs to servers through looking up a statically assigned hash table by their destination IP addressessed
shortest expected delay : assigns an incoming job to the server with the shortest expected delay. The expected delay that the job will experience is (Ci + 1) / Ui if sent to the ith server, in which Ci is the number of jobs on the ith server and Ui is the fixed service rate (weight) of the ith server.nq
never queue : assigns an incoming job to an idle server if there is, instead of waiting for a fast one; if all the servers are busy, it adopts the ShortestExpectedDelay policy to assign the job.All those come from IPVS official documentation : http://www.linuxvirtualserver.org/docs/scheduling.html
Regards