Why Do You Need the TCP Window Size?

Photo by Erik Mclean on Unsplash
Multiple packages, one acknowledge

How does my machine decide to send an acknowledgment packet to the remote server?

What is the Window Size?

This feature has two advantages:

What happens if the window size is full?

const server = new net.Server();
server.listen(8080, "0.0.0.0", function() {
console.log(`Server is ready to use.`);
});

What is the maximum value of Window Size?

(2 ^ window scale factor value) * window size.
Window size = 65,535
Window scale factor = 14
(2 ^ 14) * 65, 535
16384 * 65,635 = 1 Gigabyte

How to calculate TCP Throughput?

Window size: 65535 bytes
Window scale factor: 7
RTT: 35 ms (0.035 seconds)
Total window size per connection: (2 ^ 7) * 65535 = 8388480 Bytes8388480 * 8 = 67107840 (Window size in bit)67107840 / 0.035 = 1917366857 bits = 1917 Mbps

How to calculate the most efficient TCP Window?

Bandwith: 100 Mbps -> 100.000.000 Bits
RTT: 65 ms -> 0.065 seconds
(100.000.000 * 0.065) / 8 = 6.500.000
6.500.000 / 8 = 812.500 Bytes
812.500 / 1000 = 812 KB Window Size.

What is the difference between MSS and Window Size?

How to adjust Window Size in Linux?

sysctl net.ipv4.tcp_window_scaling
net.core.rmem_max
net.ipv4.tcp_rmem
root@main:~# sysctl net.ipv4.tcp_rmem
net.ipv4.tcp_rmem = 4096 131072 6291456

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store