Skip to content

Commit 3ff6294

Browse files
committed
add new heuristic to topology routing
1 parent ea5255c commit 3ff6294

File tree

1 file changed

+64
-35
lines changed
  • keps/sig-network/2433-topology-aware-hints

1 file changed

+64
-35
lines changed

keps/sig-network/2433-topology-aware-hints/README.md

Lines changed: 64 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@
1616
- [Kube-Proxy](#kube-proxy)
1717
- [EndpointSlice Controller](#endpointslice-controller)
1818
- [Heuristics](#heuristics)
19-
- [Proportional CPU Heuristic](#proportional-cpu-heuristic)
20-
- [Assumptions](#assumptions)
21-
- [Identifying Zones](#identifying-zones)
19+
- [Identifying Zones](#identifying-zones)
2220
- [Excluding Control Plane Nodes](#excluding-control-plane-nodes)
23-
- [Example](#example)
2421
- [Overload](#overload)
2522
- [Handling Node Updates](#handling-node-updates)
23+
- [Proportional CPU Heuristic](#proportional-cpu-heuristic)
24+
- [Assumptions](#assumptions)
25+
- [Example](#example)
26+
- [Proportional Pod Heuristic](#proportional-pod-heuristic)
27+
- [Assumptions](#assumptions-1)
28+
- [Example](#example-1)
2629
- [Additional Heuristics](#additional-heuristics)
2730
- [Future Expansion](#future-expansion)
2831
- [Test Plan](#test-plan)
@@ -307,26 +310,14 @@ This KEP starts with the following heuristics:
307310
|-|-|
308311
| Auto | EndpointSlice controller and/or underlying dataplane can choose the heuristic used. |
309312
| ProportionalByCore | Endpoints will be allocated to each zone proportionally, based on the allocatable Node CPU cores in each zone. |
313+
| ProportionalByPod | Endpoints will be allocated to each zone proportionally, based on the destination Pods in each zone. |
310314

311315
In the future, additional heuristics may be added. Until that point, "Auto" will
312316
be the only configurable value. In most clusters, that will translate to
313317
`ProportionalByCore` unless the underlying dataplane has a better approach
314318
available.
315319

316-
### Proportional CPU Heuristic
317-
#### Assumptions
318-
319-
- Incoming traffic is proportional to the number of allocatable CPU cores in a
320-
zone. Although this is an imperfect metric, it is the best available way of
321-
predicting how much traffic will be received in a zone. If we are unable to
322-
derive the number of allocatable cores in a zone we will fall back to the
323-
number of nodes in that zone.
324-
- Service capacity is proportional to the number of endpoints in a zone. This
325-
assumes that each endpoint has equivalent capacity. Although this is not
326-
always true, it usually is. We can explore ways to deal with variable capacity
327-
endpoints in the future.
328-
329-
#### Identifying Zones
320+
### Identifying Zones
330321

331322
The EndpointSlice controller reads the standard `topology.kubernetes.io/zone`
332323
label on Nodes to determine which zone a Pod is running in. Kube-Proxy would be
@@ -340,23 +331,6 @@ calculating allocatable cores in a zone:
340331
* `node-role.kubernetes.io/control-plane`
341332
* `node-role.kubernetes.io/master`
342333

343-
#### Example
344-
345-
zone-a: 20 CPU cores
346-
zone-b: 16 CPU cores
347-
zone-c: 14 CPU cores
348-
349-
In this scenario, the following proportion of endpoints would be allocated for
350-
each Service:
351-
352-
zone-a: 40%
353-
zone-b: 32%
354-
zone-c: 28%
355-
356-
When allocating endpoints to meet this distribution, keeping endpoints in the
357-
same zone will be prioritized. When same-zone endpoints are exhausted, endpoints
358-
will be taken from zones that have excess capacity.
359-
360334
#### Overload
361335

362336
Overload is a key concept for this proposal. This occurs when there are less
@@ -393,6 +367,61 @@ of the following scenarios:
393367
2. A new Node results in a Service that is able to achieve an endpoint
394368
distribution below 20% for the first time.
395369

370+
### Proportional CPU Heuristic
371+
372+
#### Assumptions
373+
374+
- Incoming traffic is proportional to the number of allocatable CPU cores in a
375+
zone. Although this is an imperfect metric, it is the best available way of
376+
predicting how much traffic will be received in a zone. If we are unable to
377+
derive the number of allocatable cores in a zone we will fall back to the
378+
number of nodes in that zone.
379+
- Service capacity is proportional to the number of endpoints in a zone. This
380+
assumes that each endpoint has equivalent capacity. Although this is not
381+
always true, it usually is. We can explore ways to deal with variable capacity
382+
endpoints in the future.
383+
#### Example
384+
385+
zone-a: 20 CPU cores
386+
zone-b: 16 CPU cores
387+
zone-c: 14 CPU cores
388+
389+
In this scenario, the following proportion of endpoints would be allocated for
390+
each Service:
391+
392+
zone-a: 40%
393+
zone-b: 32%
394+
zone-c: 28%
395+
396+
When allocating endpoints to meet this distribution, keeping endpoints in the
397+
same zone will be prioritized. When same-zone endpoints are exhausted, endpoints
398+
will be taken from zones that have excess capacity.
399+
400+
### Proportional Pod Heuristic
401+
402+
#### Assumptions
403+
404+
- Incoming traffic is the same for all zones.
405+
- Service capacity is proportional to the number of endpoints in a zone. This
406+
assumes that each endpoint has equivalent capacity.
407+
408+
This avoids the problem of blackholing traffic in case some zone run out of endpoints,
409+
but is still an imperfect method to achieve perfect traffic distribution.
410+
411+
#### Example
412+
413+
zone-a: 2 endpoints
414+
zone-b: 1 endpoint
415+
zone-c: 3 endpoints
416+
417+
In this scenario, each zone will server the same number of endpoints:
418+
419+
Total endpoints / number of zones = 6 / 3 = 2 endpoints per zone
420+
421+
When allocating endpoints to meet this distribution, keeping endpoints in the
422+
same zone will be prioritized. When same-zone endpoints are exhausted, endpoints
423+
will be taken from zones that have excess capacity.
424+
396425
### Additional Heuristics
397426
To enable additional heuristics to be added in the future, we will:
398427

0 commit comments

Comments
 (0)