Wednesday, July 29, 2020

Improve single stream connection between two site, TCP Window Sizing

Hello,

I have two sites each running pfSense and an ArchLinux server behind the router. Ping from site A to B shows an RTT of about 46ms (0.046s). The theoretical line speed is about 150mbps. If you consider some losses than we can take this to 140mbps.

If i run 20 parallel iperf session betwen the two sites i get line speed.

$ iperf3 -c siteB -p 5201 -P 20 Connecting to host siteB, port 5201 [SUM] 0.00-10.00 sec 185 MBytes 155 Mbits/sec 290 sender [SUM] 0.00-10.05 sec 173 MBytes 144 Mbits/sec receiver 

A single stream can only get me 14 mbps

$ iperf3 -c siteB -p 5201 Connecting to host siteB, port 5201 [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-10.00 sec 16.6 MBytes 13.9 Mbits/sec 32 sender [ 5] 0.00-10.05 sec 14.1 MBytes 11.7 Mbits/sec receiver 

I was hoping to increase the single connection speed between the two sites by adjusting the TCP window size.

The ideal TCP windows size = 150E6*0.046/(8*1024)=786KB.

However I am not able to set it and the maximum i can go is 416KB,

$ iperf3 -c siteB -p 5201 -w 786K Connecting to host siteB, port 5201 iperf3: error - socket buffer size not set correctly 

With a window size of 416KB, i still get poor speed,

$ iperf3 -c siteB -p 5201 -w 416K Connecting to host siteB, port 5201 [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-10.00 sec 15.5 MBytes 13.0 Mbits/sec 21 sender [ 5] 0.00-10.05 sec 14.8 MBytes 12.3 Mbits/sec receiver 

I checked the default window size in Arch Linux

# sysctl net.core.wmem_max; sysctl net.core.rmem_max; sysctl net.core.rmem_default; sysctl net.core.wmem_default;sysctl net.ipv4.tcp_rmem; sysctl net.ipv4.tcp_wmem; sysctl net.ipv4.tcp_window_scaling net.core.wmem_max = 212992 net.core.rmem_max = 212992 net.core.rmem_default = 212992 net.core.wmem_default = 212992 net.ipv4.tcp_rmem = 4096 131072 6291456 net.ipv4.tcp_wmem = 4096 16384 4194304 net.ipv4.tcp_window_scaling = 1 

The default size is 208KB = (212992/8) which is lower than my ideal window size of 786KB.

Is there anything i can do to improve the single connection speed?



No comments:

Post a Comment