0

I'm new to network administration and have a question. I am conducting research on whether it is possible to carry out TCP tuning using the genetic algorithm method. To do this, I wrote a Python program that takes a set of parameters and iterates through it using a genetic algorithm. After setting each set of parameters, I check the speed with the iperf utility. However, ultimately the speed does not increase. What am I doing wrong?

Here is a set of parameters that the program changes and a set of values that the genetic algorithm tries for each parameter.

'net.ipv4.tcp_app_win' : (0, 31),
'net.ipv4.tcp_window_scaling': [0, 1],
'net.ipv4.tcp_congestion_control' : ['reno', 'cubic', 'htcp'],
'net.ipv4.tcp_no_metrics_save' : [0, 1],
'net.core.netdev_max_backlog' : (1000, 10000),
'net.ipv4.tcp_timestamps' : [0, 1],
'net.core.rmem_max': (4096, 16777216),
'net.core.wmem_max': (4096, 16777216),
'net.core.rmem_default': (4096, 16777216),
'net.core.wmem_default': (4096, 16777216),
'net.ipv4.tcp_rmem' : [4096 ,131072,  5912352],
'net.ipv4.tcp_wmem' : [4096 ,131072,  5912352],
'net.ipv4.tcp_sack' : [0, 1],
'net.ipv4.tcp_dsack' : [0, 1],
'net.ipv4.tcp_fack' : [0, 1],
'net.ipv4.tcp_fastopen' : [1, 2, 4],
'net.ipv4.tcp_slow_start_after_idle': [0, 1],
'net.ipv4.tcp_keepalive_time' : (60, 7200),
'net.ipv4.tcp_keepalive_intvl' : (1, 75),
'net.ipv4.tcp_keepalive_probes' : (1, 9),
'net.core.netdev_max_backlog' : [1000, 5000],
'net.ipv4.tcp_max_syn_backlog' : (256, 300000),
'net.core.somaxconn' : (1024, 30000),
'net.ipv4.tcp_fin_timeout' : (10, 60),
'net.ipv4.tcp_syncookies' : [0, 1],
'net.ipv4.tcp_tw_reuse' : [0, 1],
'tcp_moderate_rcvbuf' : [0, 1],
'net.ipv4.tcp_synack_retries' : (1, 5),
'net.ipv4.tcp_max_orphans' : [512, 1024, 2048, 4096]

I will also note. Let's say that based on the results I get a fairly good set of parameter values, the network bandwidth in iperf is, say, 500 megabytes per second. If I test the bandwidth again on this set of values, the bandwidth value changes, sometimes significantly. Is there a way to do more definitive testing?

8
  • Seems like you're confusing throughput with bandwidth.
    – sawdust
    Commented Jan 19 at 3:33
  • 2
    What are you doing to make the test challenging? If you're just doing a single IPerf TCP stream over an isolated gigabit Ethernet link, you're going to be able to saturate the link (hit gigabit Ethernet's theoretical max throughput of 943Mbps after overhead) out-of-the-box even with a machine from 2 decades ago. You only need about a 1GHz single core CPU to saturate gigabit Ethernet. So if that's all you're testing, it's no wonder nothing you're tweaking is improving speed. You could be maxed out already, because Linux's TCP stack comes pretty well-tuned for the "general case" out of the box.
    – Spiff
    Commented Jan 19 at 3:46
  • 1
    Also, you may need to write your own sockets code instead of relying on IPerf, because IPerf's code may be using ioctls or other APIs to override the stack's defaults. I don't recall IPerf having a setting to tell it to use the stack's defaults, so it may be smartly tuning its own parameters via ioctls or similar mechanisms for its own sockets, ignoring whatever defaults you've set in kernel variables via sysctls or the /proc filesystem.
    – Spiff
    Commented Jan 19 at 3:49
  • 1
    Moving the test host further away would probably help. Some of the parameters you have are environment-dependent, e.g. SACK probably does nothing in a perfect test lab but is apparently very important to have as soon as you start getting just a little packet loss; likewise, TCP window size scaling becomes really important to have enabled above a certain bandwidth×delay even though you won't notice its absence on a local test LAN; and so on, and so on. Commented Jan 19 at 4:56
  • 1
    (and then some parameters like tcp_keepalive have nothing to do with performance whatsoever... I would say that although it may be possible to use your method to choose good parameters, it requires understanding at least to some extent whether you're choosing relevant parameters in the first place.) Commented Jan 19 at 4:58

0

You must log in to answer this question.

Browse other questions tagged .