Simulate latency (delay) and packet loss

I just found this "MSS=60" in the capture of the file transfer from site:

36	92.064383	10.102.0.43	10.1.151.50	TCP	52	49991 β†’ 63760 [SYN] Seq=0 Win=65535 Len=0 MSS=60 WS=128 SACK_PERM=1
37	92.064763	10.1.151.50	10.102.0.43	TCP	52	63760 β†’ 49991 [SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 MSS=1460 WS=256 SACK_PERM=1

No idea yet why it gets send out, but the PLC applies it and the PC sets it to 536.
Such small packets causing for sure a slow throughput.

I am wondering if there is a minimum MSS size which you have to maintain.
The default TCP maximum segment size is 536, I am wondering if the PLC is allowed to go below it, even when it gets the request by the SYN packet.

Oh boy, I found the problem which caused the main issue:

The number after the mssfix are the bytes now.
In older versions it just enabled or disabled it, but in the current version you have to write it like this:
option mssfix ' '

On this way has it set the MSS to 1, but is was limited somwhere to 60.
The PLC applied the 60, the PC applied the 536 and this was the reason why it was worse on the PLC side compared to the PC.
Probably got the PLC overflooded by a high amount of small packtes and this caused further problems.

I will have a look on Monday if there is anything else not in order with the PLC, because something is still strange when packets get re-ordered and I think I will create a new setup without VPN to prevent any problems from there.

Thank you very much for your help and support!

1 Like

Yep, that'd do it. Glad you figured it out, hopefully with mssfix set to something like 500 or 1000 or even 1400 or whatever it will just behave more normally.

Yes, mssfix is not set to any value, so it applies its default value from my option fragment '1344' setting and my TCP packet size is now 1287 byte, what sounds reasonable to me.

The upload time from the PC looks pretty stable at around 9s, the PLC upload time varies between 9s - 36s, what is for sure much better as it was before.

I will do more tests (delay, packet loss, packet re-ordering) next week with a router only setup to prevent any influences from the Internet or VPN line during my tests.

1 Like

I got some interesting test results how the throughput changes with delays in the line as well as when package reordering starts.
The delay has a high influence on it (what would have expected somehow), but the package reordering much more (what I did not expect, since TCP should be able to handle it).

Via VPN:
2019-02-01_14-20-19_Windows_PowerShell

Without VPN:
2019-02-01_14-24-41_Windows_PowerShell

It is only TCP where the bandwith drops, UDP works fine, even with the delay and the packet-reordering.

Test without VPN, directly connected to the OpenWRT router.
PC->USB->Ethernet->Router1-> Router2 (iperf3 server)
Delay and packet reordering is enabled: tc qdisc add dev br-lan root netem delay 190ms 10ms 25%

TCP:

iperf-3.1.3-win64> .\iperf3.exe -c 10.1.222.253
Connecting to host 10.1.222.253, port 5201
[  4] local 192.168.80.2 port 5841 connected to 10.1.222.253 port 5201
[ ID] Interval           Transfer     Bandwidth
[  4]   0.00-1.00   sec   256 KBytes  2.10 Mbits/sec
[  4]   1.00-2.00   sec   256 KBytes  2.10 Mbits/sec
[  4]   2.00-3.00   sec   128 KBytes  1.05 Mbits/sec
[  4]   3.00-4.00   sec  0.00 Bytes  0.00 bits/sec
[  4]   4.00-5.00   sec   128 KBytes  1.05 Mbits/sec
[  4]   5.00-6.00   sec  0.00 Bytes  0.00 bits/sec
[  4]   6.00-7.00   sec   128 KBytes  1.05 Mbits/sec
[  4]   7.00-8.00   sec  0.00 Bytes  0.00 bits/sec
[  4]   8.00-9.00   sec  0.00 Bytes  0.00 bits/sec
[  4]   9.00-10.00  sec   128 KBytes  1.05 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth
[  4]   0.00-10.00  sec  1.00 MBytes   839 Kbits/sec                  sender
[  4]   0.00-10.00  sec   821 KBytes   673 Kbits/sec                  receiver

iperf Done.

UDP:

iperf3.exe -c 10.1.222.253 -u -b 0
Connecting to host 10.1.222.253, port 5201
[  4] local 192.168.80.2 port 50170 connected to 10.1.222.253 port 5201
[ ID] Interval           Transfer     Bandwidth       Total Datagrams
[  4]   0.00-1.00   sec  11.7 MBytes  97.9 Mbits/sec  1500
[  4]   1.00-2.01   sec  11.4 MBytes  95.5 Mbits/sec  1460
[  4]   2.01-3.01   sec  11.4 MBytes  95.6 Mbits/sec  1460
[  4]   3.01-4.00   sec  11.2 MBytes  95.0 Mbits/sec  1440
[  4]   4.00-5.00   sec  11.4 MBytes  95.5 Mbits/sec  1460
[  4]   5.00-6.00   sec  11.4 MBytes  95.5 Mbits/sec  1460
[  4]   6.00-7.01   sec  11.4 MBytes  95.5 Mbits/sec  1460
[  4]   7.01-8.01   sec  11.4 MBytes  95.5 Mbits/sec  1460
[  4]   8.01-9.00   sec  11.3 MBytes  95.6 Mbits/sec  1450
[  4]   9.00-10.00  sec  11.4 MBytes  95.5 Mbits/sec  1460
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Jitter    Lost/Total Datagrams
[  4]   0.00-10.00  sec   114 MBytes  95.7 Mbits/sec  4.737 ms  12085/14604 (83%)
[  4] Sent 14604 datagrams

iperf Done.

Why has UDP no problems with the delay and the packet-reordering but TCP has?

Poor and older implementations of TCP will acknowledge the first packet that is part of the contiguous reconstruction, forcing the sender to resend everything else, you can imagine if you send 10 packets and the first one arrives last that you will resend the other 9.

There might be options you can enable in the PLC to do selective packet acknowledgement which should mitigate.

I did this iperf3 test with a Windows 10 PC connected to an USB Ethernet adapter to an OpenWRT router which routes (and delays) the traffic to a second OpenWRT (10.1.222.253) router which acts as FTP server.
Both running with OpenWRT 18.06.1.

All those devices are capable of selective acknowledgement but it has to be negotiated by both endpoints. here's an overview
http://packetlife.net/blog/2010/jun/17/tcp-selective-acknowledgments-sack/

Your PLC may not support it ... :frowning:

1 Like

This is the Wireshark capture of my FTP upload test from the OpenWRT router (10.1.222.253). Routed, delayed and packets reorderd via another OpenWRT router (10.1.222.254 &192.168.80.1) to a Windows 10 PC (192.168.80.2), there is no PLC involved in all of my iperf3 tests.

Right, so you may be able to force the devices you are doing these tests on to use selective acknowledgement because their operating systems are going to support it.... but if you manage to get that to work... it doesn't mean you can get it to work with the PLC unfortunately, since both ends of the conversation must support it.

I'm interested to see what your wireshark looks like. I'll take a look and see if there's anything I can figure out from that.

So when I look at your very slow transfer, there's a TCP conversation you can filter out using this filter that's the main data transfer:

(ip.addr eq 192.168.80.2 and ip.addr eq 10.1.222.253) and (tcp.port eq 5841 and tcp.port eq 5201)

packet 30 is an Ack for the first 38 bytes, and then packet 34 is the first data transfer for byte 13178 so about 13000 bytes are missing. the receiver then in packet 35 re-acks the 38th byte indicating to the sender "Hey I haven't gotten anything past byte 38" then the receiver receives in packet 36 seq number 7338 (out of order) and receiver sends again "ack 38" .... this continues like this quite a bit... basically almost all the bytes being sent are arriving out of order and the receiver is ignoring anything that comes in that isn't byte 39 and onward....

So you can imagine this is terribly inefficient because only 1 in 100 packets is useful to the reconstruction.

TCP selective ACK would, instead of ACK=38 say "ACK=38, SACK=13178" on packet 35 which would tell the sender "Hey I haven't received past byte 38 but I did receive bytes starting at 13178" so at least eventually the packet for bytes 13178 wouldn't need to get resent.

With this much reordering though, I suspect you'll never get anything fast even with SACK.

I just created a simple test environment in a VMware, the password is 123456.

OpenWrt1: 192.168.1.11
OpenWrt2: 192.168.1.12
On both systems is a iperf3 server running as well as tc and tcpdump is installed.

root@OpenWrt2:~# tc qdisc del root dev br-lan

root@OpenWrt1:~# iperf3 -c 192.168.1.12
Connecting to host 192.168.1.12, port 5201
[  5] local 192.168.1.11 port 55874 connected to 192.168.1.12 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec   405 MBytes  3.39 Gbits/sec    0    448 KBytes
[  5]   1.00-2.00   sec   414 MBytes  3.47 Gbits/sec    0    448 KBytes
[  5]   2.00-3.00   sec   376 MBytes  3.15 Gbits/sec    0    448 KBytes
[  5]   3.00-4.00   sec   438 MBytes  3.68 Gbits/sec    0    448 KBytes
[  5]   4.00-5.00   sec   461 MBytes  3.87 Gbits/sec    0    448 KBytes
[  5]   5.00-6.00   sec   468 MBytes  3.93 Gbits/sec    0    448 KBytes
[  5]   6.00-7.00   sec   451 MBytes  3.79 Gbits/sec    0    448 KBytes
[  5]   7.00-8.00   sec   409 MBytes  3.43 Gbits/sec    0    448 KBytes
[  5]   8.00-9.00   sec   464 MBytes  3.90 Gbits/sec    0    448 KBytes
[  5]   9.00-10.00  sec   464 MBytes  3.89 Gbits/sec    0    448 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  4.25 GBytes  3.65 Gbits/sec    0             sender
[  5]   0.00-10.02  sec  4.25 GBytes  3.64 Gbits/sec                  receiver

iperf Done.
root@OpenWrt1:~# iperf3 -c 192.168.1.12 -u -b0
Connecting to host 192.168.1.12, port 5201
[  5] local 192.168.1.11 port 41127 connected to 192.168.1.12 port 5201
[ ID] Interval           Transfer     Bitrate         Total Datagrams
[  5]   0.00-1.00   sec  72.0 MBytes   604 Mbits/sec  52110
[  5]   1.00-2.00   sec  78.7 MBytes   660 Mbits/sec  56970
[  5]   2.00-3.00   sec  84.8 MBytes   712 Mbits/sec  61420
[  5]   3.00-4.00   sec  85.8 MBytes   720 Mbits/sec  62120
[  5]   4.00-5.00   sec  83.9 MBytes   704 Mbits/sec  60740
[  5]   5.00-6.00   sec  81.0 MBytes   680 Mbits/sec  58690
[  5]   6.00-7.00   sec  84.0 MBytes   705 Mbits/sec  60840
[  5]   7.00-8.00   sec  82.9 MBytes   696 Mbits/sec  60050
[  5]   8.00-9.00   sec  81.3 MBytes   682 Mbits/sec  58890
[  5]   9.00-10.00  sec  82.9 MBytes   696 Mbits/sec  60060
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Jitter    Lost/Total Datagrams
[  5]   0.00-10.00  sec   817 MBytes   686 Mbits/sec  0.000 ms  0/591890 (0%)  sender
[  5]   0.00-10.03  sec   815 MBytes   682 Mbits/sec  0.008 ms  1361/591889 (0.23%)  receiver

iperf Done.

root@OpenWrt2:~# tc qdisc del root dev br-lan
root@OpenWrt2:~# tc qdisc add dev br-lan root netem delay 190ms

root@OpenWrt1:~# iperf3 -c 192.168.1.12
Connecting to host 192.168.1.12, port 5201
[  5] local 192.168.1.11 port 55886 connected to 192.168.1.12 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec   877 KBytes  7.18 Mbits/sec    0    226 KBytes
[  5]   1.00-2.00   sec  2.08 MBytes  17.4 Mbits/sec    0    865 KBytes
[  5]   2.00-3.00   sec  2.09 MBytes  17.6 Mbits/sec    0    865 KBytes
[  5]   3.00-4.00   sec  1.92 MBytes  16.1 Mbits/sec    0    865 KBytes
[  5]   4.00-5.00   sec  2.49 MBytes  20.9 Mbits/sec    0    865 KBytes
[  5]   5.00-6.00   sec  2.19 MBytes  18.3 Mbits/sec    0    865 KBytes
[  5]   6.00-7.00   sec  2.11 MBytes  17.7 Mbits/sec    0    865 KBytes
[  5]   7.00-8.00   sec  2.07 MBytes  17.3 Mbits/sec    0    882 KBytes
[  5]   8.00-9.00   sec  2.45 MBytes  20.6 Mbits/sec    0    882 KBytes
[  5]   9.00-10.00  sec  1.99 MBytes  16.7 Mbits/sec    0    882 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  20.2 MBytes  17.0 Mbits/sec    0             sender
[  5]   0.00-10.19  sec  20.0 MBytes  16.4 Mbits/sec                  receiver

iperf Done.
root@OpenWrt1:~# iperf3 -c 192.168.1.12 -u -b0
Connecting to host 192.168.1.12, port 5201
[  5] local 192.168.1.11 port 58341 connected to 192.168.1.12 port 5201
[ ID] Interval           Transfer     Bitrate         Total Datagrams
[  5]   0.00-1.00   sec  78.8 MBytes   661 Mbits/sec  57070
[  5]   1.00-2.00   sec  83.7 MBytes   702 Mbits/sec  60620
[  5]   2.00-3.00   sec  84.4 MBytes   708 Mbits/sec  61140
[  5]   3.00-4.00   sec  83.8 MBytes   703 Mbits/sec  60680
[  5]   4.00-5.00   sec  84.1 MBytes   706 Mbits/sec  60930
[  5]   5.00-6.00   sec  84.9 MBytes   712 Mbits/sec  61480
[  5]   6.00-7.00   sec  83.2 MBytes   698 Mbits/sec  60240
[  5]   7.00-8.00   sec  84.6 MBytes   710 Mbits/sec  61290
[  5]   8.00-9.00   sec  83.2 MBytes   698 Mbits/sec  60220
[  5]   9.00-10.00  sec  83.4 MBytes   700 Mbits/sec  60410
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Jitter    Lost/Total Datagrams
[  5]   0.00-10.00  sec   834 MBytes   700 Mbits/sec  0.000 ms  0/604080 (0%)  sender
[  5]   0.00-10.24  sec   834 MBytes   683 Mbits/sec  0.011 ms  398/604080 (0.066%)  receiver

iperf Done.

root@OpenWrt2:~# tc qdisc del root dev br-lan
tc qdisc add dev br-lan root netem delay 190ms 10ms 25%

root@OpenWrt1:~# iperf3 -c 192.168.1.12
Connecting to host 192.168.1.12, port 5201
[  5] local 192.168.1.11 port 55880 connected to 192.168.1.12 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec   755 KBytes  6.18 Mbits/sec    0    226 KBytes
[  5]   1.00-2.00   sec  2.06 MBytes  17.3 Mbits/sec    0    880 KBytes
[  5]   2.00-3.00   sec  2.55 MBytes  21.4 Mbits/sec    0    880 KBytes
[  5]   3.00-4.00   sec  2.05 MBytes  17.2 Mbits/sec    0    880 KBytes
[  5]   4.00-5.00   sec  2.05 MBytes  17.2 Mbits/sec    0    880 KBytes
[  5]   5.00-6.00   sec  2.30 MBytes  19.3 Mbits/sec    0    880 KBytes
[  5]   6.00-7.00   sec  2.36 MBytes  19.8 Mbits/sec    0    880 KBytes
[  5]   7.00-8.00   sec  2.24 MBytes  18.8 Mbits/sec    0    880 KBytes
[  5]   8.00-9.00   sec  2.17 MBytes  18.3 Mbits/sec    0    880 KBytes
[  5]   9.00-10.00  sec  2.24 MBytes  18.8 Mbits/sec    0    880 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  20.8 MBytes  17.4 Mbits/sec    0             sender
[  5]   0.00-10.19  sec  20.4 MBytes  16.8 Mbits/sec                  receiver

iperf Done.
root@OpenWrt1:~# iperf3 -c 192.168.1.12 -u -b0
Connecting to host 192.168.1.12, port 5201
[  5] local 192.168.1.11 port 56460 connected to 192.168.1.12 port 5201
[ ID] Interval           Transfer     Bitrate         Total Datagrams
[  5]   0.00-1.00   sec  82.7 MBytes   694 Mbits/sec  59880
[  5]   1.00-2.00   sec  85.5 MBytes   717 Mbits/sec  61880
[  5]   2.00-3.00   sec  84.5 MBytes   709 Mbits/sec  61160
[  5]   3.00-4.00   sec  85.1 MBytes   714 Mbits/sec  61600
[  5]   4.00-5.00   sec  84.7 MBytes   711 Mbits/sec  61370
[  5]   5.00-6.00   sec  85.1 MBytes   714 Mbits/sec  61660
[  5]   6.00-7.00   sec  85.0 MBytes   713 Mbits/sec  61530
[  5]   7.00-8.00   sec  82.9 MBytes   695 Mbits/sec  60010
[  5]   8.00-9.00   sec  73.1 MBytes   613 Mbits/sec  52950
[  5]   9.00-10.00  sec  74.7 MBytes   627 Mbits/sec  54120
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Jitter    Lost/Total Datagrams
[  5]   0.00-10.00  sec   823 MBytes   691 Mbits/sec  0.000 ms  0/596160 (0%)  sender
[  5]   0.00-10.23  sec   823 MBytes   675 Mbits/sec  0.008 ms  101/596159 (0.017%)  receiver

The UDP throughput stays almost at the same in all situations, but the TCP throughput goes down drastically when I activate a delay, independent from the packet-reordering.

Without any delay, TCP is 5 times higher as UDP.

Nice testing results. TCP has a bunch of timers involved, including all the various possible options, it's a fairly complicated algorithm. One thing that might be happening is as your delays get up in the 190ms range, your round trip time is enough that the ACK doesn't come fast enough and the sender winds up re-transmitting under the assumption the packet was lost and no ack is coming... or something similar. There are a large number of sysctls available to tune TCP in the Linux kernel, but I don't know how many of them will help when only one side of the connection supports it.

https://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt

You might want to start looking for whitepapers or journal articles etc on tuning TCP performance in high delay applications. It's a pretty specialized area of knowledge.

Some of the relevant stuff is around "Bandwidth Delay Product" (BDP) supposing you have a reasonably fast connection, say 10 Mbps, but a very long delay, say 200ms each direction. Then you can push 10Mbps * 0.2 s = 2Mb = 256 kilobytes onto the wire before the other end even sees anything and you could push 512 kilobytes onto the wire before you receive an ack (RTT is 0.4 s). at 1500 bytes per packet that's 167 packets or so one way, and 334 packets round trip. So you'll need large buffers and selective acknowledgement, and etc etc to make this efficient, otherwise you'll send say 3 packets, wait 0.4 ms for acks, and then send 3 more packets... or whatever, TCP can somewhat tune itself but it does make some assumptions about delay times that you might be able to tune and certainly can tune buffers so it can accumulate out of order packets and delay ACKs so that it can acknowledge more packets all at once.

1 Like

It looks as if the throughput is directly related to the latency with TCP.

root@OpenWrt2:~# tc qdisc del root dev br-lan
root@OpenWrt2:~# tc qdisc add dev br-lan root netem delay 100ms
root@OpenWrt1:~# iperf3 -c 192.168.1.12
Connecting to host 192.168.1.12, port 5201
[  5] local 192.168.1.11 port 55906 connected to 192.168.1.12 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  2.42 MBytes  20.3 Mbits/sec    0    868 KBytes
[  5]   1.00-2.00   sec  4.17 MBytes  35.0 Mbits/sec    0    868 KBytes
[  5]   2.00-3.00   sec  4.09 MBytes  34.3 Mbits/sec    0    868 KBytes
[  5]   3.00-4.00   sec  4.16 MBytes  34.9 Mbits/sec    0    868 KBytes
[  5]   4.00-5.00   sec  4.16 MBytes  34.9 Mbits/sec    0    868 KBytes
[  5]   5.00-6.00   sec  3.98 MBytes  33.4 Mbits/sec    0    868 KBytes
[  5]   6.00-7.00   sec  3.85 MBytes  32.3 Mbits/sec    0    868 KBytes
[  5]   7.00-8.00   sec  4.10 MBytes  34.4 Mbits/sec    0    868 KBytes
[  5]   8.00-9.00   sec  3.85 MBytes  32.3 Mbits/sec    0    868 KBytes
[  5]   9.00-10.00  sec  3.98 MBytes  33.4 Mbits/sec    0    868 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  38.8 MBytes  32.5 Mbits/sec    0             sender
[  5]   0.00-10.10  sec  38.3 MBytes  31.8 Mbits/sec                  receiver

iperf Done.
root@OpenWrt2:~# tc qdisc del root dev br-lan
root@OpenWrt2:~# tc qdisc add dev br-lan root netem delay 50ms
root@OpenWrt1:~# iperf3 -c 192.168.1.12
Connecting to host 192.168.1.12, port 5201
[  5] local 192.168.1.11 port 55914 connected to 192.168.1.12 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  6.59 MBytes  55.2 Mbits/sec    0    885 KBytes
[  5]   1.00-2.00   sec  7.85 MBytes  65.9 Mbits/sec    0    885 KBytes
[  5]   2.00-3.00   sec  7.80 MBytes  65.4 Mbits/sec    0    885 KBytes
[  5]   3.00-4.00   sec  7.89 MBytes  66.2 Mbits/sec    0    885 KBytes
[  5]   4.00-5.00   sec  7.43 MBytes  62.3 Mbits/sec    0    885 KBytes
[  5]   5.00-6.00   sec  7.58 MBytes  63.6 Mbits/sec    0    885 KBytes
[  5]   6.00-7.00   sec  8.11 MBytes  68.0 Mbits/sec    0    885 KBytes
[  5]   7.00-8.00   sec  7.61 MBytes  63.9 Mbits/sec    0    885 KBytes
[  5]   8.00-9.00   sec  8.26 MBytes  69.3 Mbits/sec    0    885 KBytes
[  5]   9.00-10.00  sec  7.77 MBytes  65.2 Mbits/sec    0    885 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  76.9 MBytes  64.5 Mbits/sec    0             sender
[  5]   0.00-10.05  sec  76.6 MBytes  64.0 Mbits/sec                  receiver

iperf Done.
root@OpenWrt2:~# tc qdisc del root dev br-lan
root@OpenWrt2:~# tc qdisc add dev br-lan root netem delay 30ms
root@OpenWrt1:~# iperf3 -c 192.168.1.12
Connecting to host 192.168.1.12, port 5201
[  5] local 192.168.1.11 port 55918 connected to 192.168.1.12 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  11.4 MBytes  95.3 Mbits/sec    0    899 KBytes
[  5]   1.00-2.00   sec  12.2 MBytes   103 Mbits/sec    0    899 KBytes
[  5]   2.00-3.00   sec  11.9 MBytes  99.9 Mbits/sec    0    899 KBytes
[  5]   3.00-4.00   sec  11.9 MBytes   100 Mbits/sec    0    899 KBytes
[  5]   4.00-5.00   sec  11.9 MBytes   100 Mbits/sec    0    899 KBytes
[  5]   5.00-6.00   sec  11.9 MBytes   100 Mbits/sec    0    899 KBytes
[  5]   6.00-7.00   sec  11.9 MBytes   100 Mbits/sec    0    899 KBytes
[  5]   7.00-8.00   sec  12.3 MBytes   103 Mbits/sec    0    899 KBytes
[  5]   8.00-9.00   sec  11.9 MBytes   100 Mbits/sec    0    899 KBytes
[  5]   9.00-10.00  sec  11.9 MBytes   100 Mbits/sec    0    899 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec   119 MBytes   100 Mbits/sec    0             sender
[  5]   0.00-10.05  sec   119 MBytes  99.4 Mbits/sec                  receiver

iperf Done.
root@OpenWrt2:~# tc qdisc del root dev br-lan
root@OpenWrt2:~# tc qdisc add dev br-lan root netem delay 20ms
root@OpenWrt1:~# iperf3 -c 192.168.1.12
Connecting to host 192.168.1.12, port 5201
[  5] local 192.168.1.11 port 55910 connected to 192.168.1.12 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  16.8 MBytes   141 Mbits/sec    0    895 KBytes
[  5]   1.00-2.00   sec  18.0 MBytes   151 Mbits/sec    0    895 KBytes
[  5]   2.00-3.00   sec  17.3 MBytes   145 Mbits/sec    0    895 KBytes
[  5]   3.00-4.00   sec  17.9 MBytes   150 Mbits/sec    0    895 KBytes
[  5]   4.00-5.00   sec  17.9 MBytes   150 Mbits/sec    0    895 KBytes
[  5]   5.00-6.00   sec  17.4 MBytes   146 Mbits/sec    0    895 KBytes
[  5]   6.00-7.00   sec  17.9 MBytes   150 Mbits/sec    0    895 KBytes
[  5]   7.00-8.00   sec  18.1 MBytes   151 Mbits/sec    0    895 KBytes
[  5]   8.00-9.00   sec  18.2 MBytes   153 Mbits/sec    0    895 KBytes
[  5]   9.00-10.00  sec  17.4 MBytes   146 Mbits/sec    0    895 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec   177 MBytes   148 Mbits/sec    0             sender
[  5]   0.00-10.04  sec   177 MBytes   147 Mbits/sec                  receiver

iperf Done.

BTW: This is my Wireshark capture from the VMware test before, it looks pretty much the same with and without packet re-ordering.

I am wondering how I am am able to achieve a 100 MBit/s download with my Internet line at home.
According to these tests is then a 30ms latency the maximum possible delay to the server with 100 MBit/s.
What if you have a GBit/s Internet connection?

I think what's going on is what I said above. You should try tuning kernel parameters to allow large BDP and alter certain timers, for example:

sack_timeout - INTEGER
	The amount of time (in milliseconds) that the implementation will wait
	to send a SACK.

	Default: 200


tcp_rmem - vector of 3 INTEGERs: min, default, max
	min: Minimal size of receive buffer used by TCP sockets.
	It is guaranteed to each TCP socket, even under moderate memory
	pressure.
	Default: 4K

	default: initial size of receive buffer used by TCP sockets.
	This value overrides net.core.rmem_default used by other protocols.
	Default: 87380 bytes. This value results in window of 65535 with
	default setting of tcp_adv_win_scale and tcp_app_win:0 and a bit
	less for default tcp_app_win. See below about these variables.

	max: maximal size of receive buffer allowed for automatically
	selected receiver buffers for TCP socket. This value does not override
	net.core.rmem_max.  Calling setsockopt() with SO_RCVBUF disables
	automatic tuning of that socket's receive buffer size, in which
	case this value is ignored.
	Default: between 87380B and 6MB, depending on RAM size.

tcp_sack - BOOLEAN
	Enable select acknowledgments (SACKS).

tcp_comp_sack_delay_ns - LONG INTEGER
	TCP tries to reduce number of SACK sent, using a timer
	based on 5% of SRTT, capped by this sysctl, in nano seconds.
	The default is 1ms, based on TSO autosizing period.

	Default : 1,000,000 ns (1 ms)

tcp_comp_sack_nr - INTEGER
	Max numer of SACK that can be compressed.
	Using 0 disables SACK compression.

	Detault : 44

see here: https://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt

if tcp_rmem is too small then you'll send just a few packets, wait a long time for acks, and then send a few more packets. On my Debian box tcp_rmem is by default:

4096 87380 6291456

You might want to set tcp_rmem to something like:

4096 409600 6291456

and enable SACK

but again, you'll probably not have control like this on your windows machine, and it might not work well for your PLC either.

1 Like

:slight_smile: I do have that (but it's shaped to somewhat lower for various latency related reasons)

Here is a DSLReports speed test limiting my connections to 1 stream at a time:

Here is with the setting at 20 streams but it actually chooses 12:

Obviously if I demand a lot from their servers which are doing a lot of other tests at the same time, they will not deliver more than about 25 Mbps down. I can send 386 up... but if I distribute across multiple connections, then I can get full speed.

Latency is relatively low here, a few tens of ms.

I'm not sure what your OpenWrt routers have for hardware, but they may be CPU and memory limited in such a way that they don't like buffering all those packets to cause the long delays.

looks like information you should read up on :wink:

That is pretty nice man, as well as these test results!

We only get 6 MBit/s in our company for about 40 people and we already use 4 pairs of copper to get that. I added there a second Internet line via a LTE modem to get rid at least of the web traffic on the DSL line.