Comments (4)
Hi @xoancosmed
as I stumbled on this issue. The reason for not working in both directions is that tc only works for egress shaping. If you want to use it in both directions you have to apply it on both sides in egress (traffic leaving a container). You could add a limit to the server, which acts in download direction and add a limit to a client container that acts in upload direction.
If you do not use a client container you have to apply shaping on the interface the client uses, this however will be applied to all clients connected to this interface.
The reason for the 2,5 sec delay may be that the container is checking the docker api for changes, this takes some time until the rules are applied. It might be better to test against an already running container.
I hope this helps
from docker-tc.
Hi again,
I've been doing more tests and I found that the problem is with the upload tests (the above ones). These are download tests, and it seems that they work fine:
- With the limit setted at 256kps (which actually means 256 KB/s) I get around 240 KB/s:
$ docker run -it \
--net test-net \
--label "com.docker-tc.enabled=1" \
--label "com.docker-tc.limit=256kbps" \
--label "com.docker-tc.delay=1ms" \
--label "com.docker-tc.loss=0%" \
--label "com.docker-tc.duplicate=0%" \
--label "com.docker-tc.corrupt=0%" \
mlabbe/iperf3 \
iperf3 -R -c 172.20.35.249
Connecting to host 172.20.35.249, port 5201
Reverse mode, remote host 172.20.35.249 is sending
[ 5] local 172.26.0.2 port 50992 connected to 172.20.35.249 port 5201
[ ID] Interval Transfer Bitrate
[ 5] 0.00-1.00 sec 1.08 GBytes 9.32 Gbits/sec
[ 5] 1.00-2.00 sec 1.17 GBytes 10.0 Gbits/sec
[ 5] 2.00-3.00 sec 686 MBytes 5.76 Gbits/sec
[ 5] 3.00-4.00 sec 235 KBytes 1.92 Mbits/sec
[ 5] 4.00-5.00 sec 254 KBytes 2.08 Mbits/sec
[ 5] 5.00-6.00 sec 238 KBytes 1.95 Mbits/sec
[ 5] 6.00-7.00 sec 242 KBytes 1.98 Mbits/sec
[ 5] 7.00-8.00 sec 238 KBytes 1.95 Mbits/sec
[ 5] 8.00-9.00 sec 238 KBytes 1.95 Mbits/sec
[ 5] 9.00-10.00 sec 233 KBytes 1.91 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Retr
[ 5] 0.00-10.04 sec 2.93 GBytes 2.50 Gbits/sec 1623 sender
[ 5] 0.00-10.00 sec 2.92 GBytes 2.51 Gbits/sec receiver
- With the limit setted at 512kps (which actually means 512 KB/s) I get around 480 KB/s:
$ docker run -it \
--net test-net \
--label "com.docker-tc.enabled=1" \
--label "com.docker-tc.limit=256kbps" \
--label "com.docker-tc.delay=1ms" \
--label "com.docker-tc.loss=0%" \
--label "com.docker-tc.duplicate=0%" \
--label "com.docker-tc.corrupt=0%" \
mlabbe/iperf3 \
iperf3 -R -c 172.20.35.249
Connecting to host 172.20.35.249, port 5201
Reverse mode, remote host 172.20.35.249 is sending
[ 5] local 172.26.0.2 port 50996 connected to 172.20.35.249 port 5201
[ ID] Interval Transfer Bitrate
[ 5] 0.00-1.00 sec 1.12 GBytes 9.64 Gbits/sec
[ 5] 1.00-2.00 sec 1.17 GBytes 10.1 Gbits/sec
[ 5] 2.00-3.00 sec 811 MBytes 6.81 Gbits/sec
[ 5] 3.00-4.00 sec 489 KBytes 4.00 Mbits/sec
[ 5] 4.00-5.00 sec 466 KBytes 3.81 Mbits/sec
[ 5] 5.00-6.00 sec 469 KBytes 3.84 Mbits/sec
[ 5] 6.00-7.00 sec 479 KBytes 3.93 Mbits/sec
[ 5] 7.00-8.00 sec 502 KBytes 4.11 Mbits/sec
[ 5] 8.00-9.00 sec 443 KBytes 3.63 Mbits/sec
[ 5] 9.00-10.00 sec 479 KBytes 3.93 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Retr
[ 5] 0.00-10.05 sec 3.09 GBytes 2.65 Gbits/sec 2972 sender
[ 5] 0.00-10.00 sec 3.09 GBytes 2.66 Gbits/sec receiver
- With the limit setted at 1mps (which actually means 1 MB/s) I get around 930 KB/s:
$ docker run -it \
--net test-net \
--label "com.docker-tc.enabled=1" \
--label "com.docker-tc.limit=256kbps" \
--label "com.docker-tc.delay=1ms" \
--label "com.docker-tc.loss=0%" \
--label "com.docker-tc.duplicate=0%" \
--label "com.docker-tc.corrupt=0%" \
mlabbe/iperf3 \
iperf3 -R -c 172.20.35.249
Connecting to host 172.20.35.249, port 5201
Reverse mode, remote host 172.20.35.249 is sending
[ 5] local 172.26.0.2 port 51000 connected to 172.20.35.249 port 5201
[ ID] Interval Transfer Bitrate
[ 5] 0.00-1.00 sec 1.14 GBytes 9.77 Gbits/sec
[ 5] 1.00-2.00 sec 1008 MBytes 8.45 Gbits/sec
[ 5] 2.00-3.00 sec 191 MBytes 1.60 Gbits/sec
[ 5] 3.00-4.00 sec 935 KBytes 7.66 Mbits/sec
[ 5] 4.00-5.00 sec 934 KBytes 7.65 Mbits/sec
[ 5] 5.00-6.00 sec 976 KBytes 7.99 Mbits/sec
[ 5] 6.00-7.00 sec 931 KBytes 7.63 Mbits/sec
[ 5] 7.00-8.00 sec 931 KBytes 7.63 Mbits/sec
[ 5] 8.00-9.00 sec 934 KBytes 7.65 Mbits/sec
[ 5] 9.00-10.00 sec 931 KBytes 7.63 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Retr
[ 5] 0.00-10.04 sec 2.32 GBytes 1.98 Gbits/sec 2245 sender
[ 5] 0.00-10.00 sec 2.31 GBytes 1.99 Gbits/sec receiver
With this tests I conclude that: first, the rule takes about 2.5 seconds to apply (which is not really a problem in my case), and second, that the rate doesn't apply well to the outgoing traffic.
Taking a quick look to the code I see that the command executed is qdisc_tbf "$IF" rate "$LIMIT"
, so the problem may not be in docker-tc. Probably one parameter or something is missing, I'm a noobie in terms of tc, but I'll try to investigate it.
from docker-tc.
Hello, @xoancosmed
I saw your benchmarks and even tho I don't have advanced information about tc
I noticed 2 things
- With
iperf
you are benchmarking TCP speed whiletc
sets bandwidth in at most in IP (3rd) Layer and it might be lower (2nd) layer. (TCP and UDP runs on the 4th layer) - In your first post, you had 10% loss, 5% duplicate and 1% corrupt, because of that speeds are lower than upload tests.
I have no idea why you are seeing 2.5 seconds of high bandwidth, it might because of how qdisc (queue) handles them. It might be TCP buffering. There is also a burst
option which might be helpful for that kickstart issue.
My suggestion is to either use UDP or raw IP for calculating raw bandwidth.
Ref: https://www.tldp.org/HOWTO/html_single/Traffic-Control-HOWTO/#o-packets
from docker-tc.
Hi @pvtmert
Thanks for your reply. What you said makes sense ... I'll try it with IPERF in UDP mode. However, the biggest problem for me is that 2.5 seconds where it seems that there is no limit. I have to investigate more about this ...
from docker-tc.
Related Issues (15)
- Problem in parameters with Docker-TC HOT 1
- Limiting upload speed HOT 3
- How to specify network interface ? HOT 2
- Bandwidth Limiter does not work HOT 1
- not working in docker compose mode HOT 1
- Project Status / Project Transfer HOT 3
- MacOS support related??? - Cannot talk to rtnetlink: Operation not supported HOT 1
- Support for specific ports
- Warning: Network has no corresponding virtual network interface
- Docker-tc fails with multiple containers in same network HOT 11
- Docker-tc cannot update network interface after a container restarts
- Memory leak in docker-tc.sh HOT 3
- using docker-tc with kubernetes
- docker-tc configures settings on the wrong veth's
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-tc.