Eu encontrei esta informação que fala sobre tcp_adv_win_scale
. A página é intitulada: ajuste do desempenho do TCP - como ajustar o linux .
trecho
TCP performance is limited by latency and window size (and overhead, which reduces the effective window size) by window_size/RTT (this is how much data that can be "in transit" over the link at any given moment).
To get the actual transfer speeds possible you have to divide the resulting window by the latency (in seconds):
The overhead is: window/2^tcp_adv_win_scale (tcp_adv_win_scale default is 2)
So for linux default parameters for the recieve window (tcp_rmem): 87380 - (87380 / 2^2) = 65536.
Given a transatlantic link (150 ms RTT), the maximum performance ends up at: 65536/0.150 = 436906 bytes/s or about 400 kbyte/s, which is really slow today.
With the increased default size: (873800 - 873800/2^2)/0.150 = 4369000 bytes/s, or about 4Mbytes/s, which is resonable for a modern network. And note that this is the default, if the sender is configured with a larger window size it will happily scale up to 10 times this (8738000*0.75/0.150 = ~40Mbytes/s), pretty good for a modern network.
2.6.17 and later have resonably good defaults values, and actually tune the window size up to the max allowed, if the other side supports it. So since then most of this guide is not needed. For good long-haul throughput the maxiumum value might need to be increased though.
Eu pude seguir isso, mas não entendi muito bem a relação entre essas duas variáveis, se é que existe alguma.
Eu só entendia marginalmente o que isso estava tentando explicar. No núcleo, parece que esse parâmetro para dimensionar a quantidade de espaço em buffer deve ser usado para TCP e para o aplicativo.
Pesquisando um pouco mais, encontrei essas explicações que faziam mais sentido. A página foi intitulada: Ipsysctl tutorial 1.0.4 - Capítulo 3. Referência de variável IPv4 .
trecho
3.3.2. tcp_adv_win_scale
This variable is used to tell the kernel how much of the socket buffer space should be used for TCP window size, and how much to save for an application buffer. If tcp_adv_win_scale is negative, the following equation is used to calculate the buffer overhead for window scaling:
Where bytes are the amount of bytes in the window. If the tcp_adv_win_scale value is positive, the following equation is used to calculate the buffer overhead:
The tcp_adv_win_scale variable takes an integer value and is per default set to 2. This in turn means that the application buffer is 1/4th of the total buffer space specified in the tcp_rmem variable.
3.3.3. tcp_app_win
This variable tells the kernel how many bytes to reserve for a specific TCP window in the TCP sockets memory buffer where the specific TCP window is transfered in. This value is used in a calculation that specifies how much of the buffer space to reserve that looks as the following:
As you may understand from the above calculation, the larger this value gets, the smaller will the buffer space be for the specific window. The only exception to this calculation is 0, which tells the kernel to reserve no space for this specific connection. The default value for this variable is 31 and should in general be a good value. Do not change this value unless you know what you are doing.
Com base nessas explicações, soa como o primeiro parâmetro, tcp_adv_win_scale
está controlando a divisão do espaço do buffer de soquete em termos de como ela é dividida para uso da janela TCP vs. buffer de aplicativo.
Considerando que o segundo parâmetro, tcp_app_win
, está especificando o número de bytes a serem reservados para o buffer de aplicativo mencionado na descrição tcp_adv_win_scale
.