# Speed Reduction by Latency

Servers far away are slower than servers nearby. Why is that? And how big is the effect? This calculator shows how much your speed is reduced because of distance.

 Connection speed: bits per second Distance (round-trip): kilometers Block size: bytes Throughput: bits per second Latency (round trip): milliseconds

Explanation:
Networks do not transfer data in a continuous stream, as many people think, but in small packets. The server sends a packet to your computer, which sends an acknowledgement back (TCP/IP protocol). Upon receipt of the acknowledgement the server sends the next packet. This is called handshaking, it's a little game of ping-pong.

The speed of light is 299792 kilometers per second. The maximum number of ping-pongs per second is therefore 299792 divided by twice the distance between you and the server. If the server is 1000 kilometers away that's 149 ping-pongs per second. Every ping-pong is 1 packet, so if the packet size is 1 bit the server can only send you 149 bits per second. The speed of the network is immaterial, even a gigabit network cannot break the speed of light.

The server is not sending data while waiting for the acknowledgement, waiting means less throughput, so the speed is reduced because of the distance. The further away, the lower the speed.

To get around this problem TCP/IP will send a number of packets without waiting for an acknowledgment. This is called the TCP Receive Window (or RWIN), the amount of data a computer will send without waiting for an acknowledgement. When an acknowledgement for the first packet is not received before RWIN is full, then transmission stops and waits, and after a timeout the packet will be retransmitted. If RWIN is large enough then a continuous data transfer can be sustained without suffering the speed decrease calculated here.

The calculator uses the following formulas:

Speed (bits per second) =
8 * BlockSize / (Distance / 299792.458 + 8 * BlockSize / ConnectSpeed)
Latency (milliseconds) =
1000 * Distance / 299792.458

Notes:

• The size of the packets may vary, depending on things like network technology and computer settings. The maximum is usually 1500 bytes (maximum Ethernet packet size including headers).
• The optimum setting for RWIN depends on your connection speed and the latency to the server you visit. If RWIN is too low then speed suffers as calculated here. If too high then speed suffers because of packets that need to be retransmitted.
• Default RWIN depends on the operating system and the network technology. Windows 98 has a default of about 8000 bytes, Windows 2000/XP about 18000 bytes, and Linux about 65535 bytes.
• The circumference of the earth is 40076 kilometers. Cables are usually not straight, though.
• Actual latency is always higher than the distance-latency because of buffering delays in network equipment.