Latency and throughput

Thrughput is affected by latency. Higher the latency the slower your transfer speed is going to be.

To work out your throughout, the formula is (data size (bits) / latency = throughput (bits))
eg: 64KB = 65536bytes * 8 = 524288 bits. Next, latency round trip is say 200ms so we will use 0.2s in our calculation.

524288 bits / 0.2 seconds = 2,621,440 bits (2.62Mbps) is the maximum possible throughout.

A TCP packet is like a bucket of water that can carry a maximum of 1 litre. If this bucket of water takes 10ms to get from you to the destination then in 1 second you can move a maximum of 1 / 0.01 = 100 litres of water per second.

So the way to increase maximum throughout would be to either reduce the latency or increase the TCP window.

Ubuntu allows window scaling which will increase or decrease TCP window, enabling TCP window scaling will allow packet size of up to 1GB.

To enable windows scaling you will need to edit you /etc/sysctl.conf

net.ipv4.tcp_window_scaling = 1

You will also need to set minimum, initial and maximum values, the 3 buffers that are available and require adjustment if any are the default TCP buffer (net.ipv4.tcp_mem), receive socket memory (net.ipv4.tcp_rmem) and send socket memory (net.ipv4.tcp_wmem).

The values will hugely depend on the latency between you and your destination. You will need to do some trial and error in order to ascertain the value that work best for you. However, increasing the sizes will also increase your RAM usage.

A guide to setting values are here.

Comments

Popular posts from this blog

Xanmod kernel