<p>As discovered <a href="https://kubernetes.io/blog/2018/07/09/ipvs-based-in-cluster-load-balancing-deep-dive/" rel="nofollow noreferrer">here</a>, there is a new kind of kube service that are IPVS and have many algorithms for load balancing.</p>
<p>The only problem is I didn't find where those algorithms are specified.</p>
<p>My understanding:</p>
<ol>
<li><code>rr</code>: <strong>round-robin</strong>
<em>-&gt; call backend pod one after another in a loop</em></li>
<li><code>lc</code>: <strong>least connection</strong>
<em>-&gt; group all pod with the lowest number of connection, and send message to it. Which kind of connection? only the ones from this service ?</em></li>
<li><code>dh</code>: <strong>destination hashing</strong>
<em>-&gt; ?something based on url?</em></li>
<li><code>sh:</code> <strong>source hashing</strong>
<em>-&gt; ?something based on url?</em></li>
<li><code>sed</code>: <strong>shortest expected delay</strong>
<em>-&gt; either the backend with less ping or some logic on the time a backend took to respond in the past</em></li>
<li><code>nq</code>: <strong>never queue</strong>
<em>-&gt; same as least connection? but refusing messages at some points ?</em></li>
</ol>
<hr />
<p>If anyone has the documentation link (not provided in the <a href="https://kubernetes.io/docs/concepts/services-networking/service/" rel="nofollow noreferrer">official page</a> and still saying IPVS is beta whereas it is stable sync 1.11) or the real algorithm behind all of them, please help.</p>
<p>I tried: Google search with the terms + lookup in the official documentation.</p>

<p>They are defined in the code
<a href="https://github.com/kubernetes/kubernetes/blob/master/pkg/proxy/apis/config/types.go#L193" rel="noreferrer">https://github.com/kubernetes/kubernetes/blob/master/pkg/proxy/apis/config/types.go#L193</a></p>

<ul>
<li><code>rr</code> <strong>round robin</strong> : distributes jobs equally amongst the available real servers</li>
<li><code>lc</code> <strong>least connection</strong> : assigns more jobs to real servers with fewer active jobs</li>
<li><code>sh</code> <strong>source hashing</strong> : assigns jobs to servers through looking up a statically assigned hash table by their source IP addresses</li>
<li><code>dh</code> <strong>destination hashing</strong> : assigns jobs to servers through looking up a statically assigned hash table by their destination IP addresses</li>
<li><code>sed</code> <strong>shortest expected delay</strong> : 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.</li>
<li><code>nq</code> <strong>never queue</strong> : 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.</li>
</ul>

<p>All those come from IPVS official documentation : <a href="http://www.linuxvirtualserver.org/docs/scheduling.html" rel="noreferrer">http://www.linuxvirtualserver.org/docs/scheduling.html</a></p>

<p>Regards</p>
