Simple sysctl tunings for HAProxy

If you’re running a high performance HAProxy setup, there are many tweaks and settings that you can benefit from. Some of these can be complex, but there are many that can quite easily increase your performance. We’ll give you some tips here to get that extra bit of performance you need.

Sysctl is a program used to tweak kernel settings on your OS. This allows you to optimize the way your kernel handles networking.

Add these to /etc/sysctl.conf (on Linux) —

net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_max_orphans = 262144
net.ipv4.ip_local_port_range = 1024 65023
net.ipv4.tcp_fin_timeout = 30
net.core.netdev_max_backlog = 10000
net.ipv4.tcp_syncookies = 1
net.ipv4.conf.all.rp_filter = 1
net.core.somaxconn = 60000
net.ipv4.tcp_max_syn_backlog = 60000
net.ipv4.tcp_synack_retries = 3

If any give you an error it may be because of a kernel version etc, just remove the relevant line. You need to reboot or run “sysctl -p” to reload this.

HAProxy User Interface

Snapt provides a full GUI for the configuration and management of HAProxy, as well as reporting, alerts, APIs, graphing and much, much more. You can set up a brand new HAProxy installation or integrate with your existing one.


Get a free trial of Snapt today.

Subscribe Here!