How To Setup TCP Optimization On Linux

Updated on December 15, 2015
How To Setup TCP Optimization On Linux header image


Having trouble with connectivity when visitors from other countries access your website? Wondering why the download speed from your foreign server is slow? You can setup TCP optimization algorithms to help resolve the problem.

There are several well-known TCP optimization algorithms. Not all of these algorithms are free of charge, for instance, Zeta-TCP. However, in this article, I'm going to introduce a free TCP optimization algorithm with high performance known as Hybla.


To setup Hybla, you should be equipped with:

  • A VPS or dedicated server with Linux (LTS version preferred).
  • If VPS, check that the virtualization is KVM. Otherwise it won't have enough privileges to call the proper kernel functions.
  • Run /sbin/modprobe tcp_hybla to enable Hybla and use lsmod | grep hybla to check whether the optimization can work normally.


If your kernel version is newer, for instance CentOS 6.x 2.6.32, you can use the command listed below to view the available congestion algorithms. Hybla will be shown, once you've loaded it.

sysctl net.ipv4.tcp_available_congestion_control

You can temporarily setup a Vultr VPS for testing before using Hybla in a production environment.

Add the lines listed below to /etc/sysctl.conf.

net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.ip_local_port_range = 10000 65000
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_max_tw_buckets = 5000
net.core.rmem_max = 67108864
net.core.wmem_max = 67108864
net.ipv4.tcp_rmem = 4096 87380 67108864
net.ipv4.tcp_wmem = 4096 65536 67108864
net.core.netdev_max_backlog = 250000

You can enable the change immediately using the command sysctl -p. Hybla is now enabled.

Start when booting

The tutorial listed above requires that you to run the commands /sbin/modprobe hybla and sysctl -p manually after each restart. To enable this algorithm automatically, you can use these steps as a template. They were written for CentOS.

Add a hybla.modules file to the /etc/sysconfig/modules directory and enter the content below:

/sbin/modprobe tcp_hybla

Then grant the file execution privileges:

chmod +x hybla.modules