-
Notifications
You must be signed in to change notification settings - Fork 319
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
proposal: tc plugin for netqos #1954
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,12 +49,12 @@ last-updated: 2023-12-08 | |
## Glossary | ||
|
||
[ebpf](https://ebpf.io/what-is-ebpf/) | ||
|
||
[ebpf tc](https://arthurchiao.art/blog/cilium-bpf-xdp-reference-guide-zh/#prog_type_tc) | ||
|
||
[edt](https://arthurchiao.art/blog/better-bandwidth-management-with-ebpf-zh/#31-%E6%95%B4%E4%BD%93%E8%AE%BE%E8%AE%A1%E5%9F%BA%E4%BA%8E-bpfedt-%E5%AE%9E%E7%8E%B0%E5%AE%B9%E5%99%A8%E9%99%90%E9%80%9F) | ||
|
||
[terway-qos](https://github.com/AliyunContainerService/terway-qos/blob/main/README-zh_CN.md) | ||
[net_cls cgroup](https://www.kernel.org/doc/Documentation/cgroup-v1/net_cls.txt) | ||
[tc](https://man7.org/linux/man-pages/man8/tc.8.html) (traffic control) | ||
[ipset](https://linux.die.net/man/8/ipset) | ||
|
||
## Summary | ||
|
||
|
@@ -63,8 +63,7 @@ It supports limiting bandwidth by single pod and by priority on node level. Aims | |
|
||
## Motivation | ||
|
||
Currently, network bandwidth has not been taken into account in `koordinator`, | ||
and there may be certain pitfalls, such as: | ||
Issues related to network bandwidth are not addressed in "koordinator", and there may be certain pitfalls, such as: | ||
1. Low network bandwidth utilisation; | ||
2. Uneven distribution of network bandwidth load on cluster nodes; | ||
3. The QOS of high-priority processes cannot be guaranteed on a single machine. | ||
|
@@ -331,7 +330,44 @@ After that, the netqos plugin will implement the network limiting operation base | |
|
||
- <span style="color: beige; ">for node </span> | ||
we can refer to the koordinator's API directly, to do some netqos operation. | ||
|
||
The `koordlet` initializes the `tc`, `iptables`, and `ipset` rules according to `nodeslo` cr, | ||
and then it only needs to watch the pod to update the `ipset` of the `tc` class corresponding to that pod | ||
|
||
When `koordlet` starts, it creates the `tc` rules and the associated `ipset` objects on the physical `NIC` of the host. | ||
Each `tc` `class` will correspond to an `ipset` rule. This `ipset` declares a group of pods. This group of pods has the same `tc` class priority, | ||
and then share the network bandwidth in this `tc` class. By default, each `tc` `class` can use up all the network bandwidth of the node. | ||
there are three classes defined, `high_class`/`mid_class`/`low_class` , each of pods will be matched to a `tc` class. | ||
|
||
![image](/docs/images/netqos-tc.jpg) | ||
|
||
Logic for `htb qdisc` selection of specific classes: | ||
1. The `htb` algorithm starts at the bottom of the `class` tree and works its way up to find `classes` with the `CAN_SEND` status. | ||
2. If there are more than one `class` in the layer in the `CAN_SEND` state then the `class` with the highest priority (lowest value) | ||
is selected. After each `class` has sent its own `quantum` bytes, it is the next `class`'s turn to send. | ||
|
||
Configuration of parameters for the specific class corresponding to each priority pod: | ||
| PRIO | HIGH | MID | LOW | | ||
| ---- | ---- | ---- | ---- | | ||
| net_prio | 0 | 1 | 2 | | ||
| net_cls | 1:2 | 1:3 | 1:4 | | ||
| htb.rate | 40% | 30% | 30% | | ||
| htb.ceil | 100% | 100% | 100% | | ||
|
||
Specific setup method: | ||
```bash | ||
# With an entire network bandwidth of 1000Mbit, the following rules are created. | ||
tc qdisc add dev eth0 root handle 1:0 htb default 1 | ||
tc class add dev eth0 parent 1:0 classid 1:1 htb rate 1000Mbit | ||
tc class add dev eth0 parent 1:1 classid 1:2 htb rate 400Mbit ceil 1000Mbit prio 0 | ||
tc class add dev eth0 parent 1:1 classid 1:3 htb rate 300Mbit ceil 1000Mbit prio 1 | ||
tc class add dev eth0 parent 1:1 classid 1:4 htb rate 300Mbit ceil 1000Mbit prio 2 | ||
ipset create high_class hash:net | ||
iptables -t mangle -A POSTROUTING -m set --match-set high_class src -j CLASSIFY --set-class 1:2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里多介绍几句原因吧 |
||
ipset create mid_class hash:net | ||
iptables -t mangle -A POSTROUTING -m set --match-set mid_class src -j CLASSIFY --set-class 1:3 | ||
ipset create low_class hash:net | ||
iptables -t mangle -A POSTROUTING -m set --match-set low_class src -j CLASSIFY --set-class 1:4 | ||
``` | ||
|
||
|
||
#### koord-scheduler | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
后续可以考虑对入方向的支持