Home United States USA — software HAProxy Performance Tweaks: sysctl and config HAProxy Performance Tweaks: sysctl and config

HAProxy Performance Tweaks: sysctl and config HAProxy Performance Tweaks: sysctl and config

469
0
SHARE

Learn about the changes you should make to sysctl and HAProxy configurations to improve the performance of your entire setup.
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!
Warning: These are mostly kernel changes and can cause unknown issues. Please Google any changes you are unsure of, or ask us!
These are specifically designed to optimize your Linux installation forhaproxy, allowing it to perform better under peak loads and allowing you to get more requests per second.
You can apply our selected tweaks by pasting the below into your /etc/sysctl.conf file, and then running sysctl -p ” to apply the changes.
If any give you an error it may be because of a kernel version or anything else, just remove the relevant line. Remember to reboot or run sysctl -p ” to apply this.
Below are several tips to keep in mind when creating or adjusting your haproxy.cfg file.
TCP mode groups are much less load than HTTP. Check your “mode” setting under a listen, frontend, or backend section of the config. If you don’t need to do any HTTP level adjustments then TCP mode will be much faster.
HAProxy limits connections on a global level as well as a frontend/listen level to the maxconn setting. It restricts the maximum number of connections HAProxy will accept (at a time) , so make sure it’s high enough. You can use this in groups as well as globally. In Snapt, this is called “Maximum Connections.”
Make sure you don’t have it set high in the “global” section of the config, but not high enough in the “listen” or “frontend” section!
Only use what you require when choosing a balance method. Remember that roundrobin is going to be much faster, so if there is no requirement for a more advanced method don’ t use it (in performance sensitive situations) .
HTTP compression uses a lot of CPU, and if you are in a high-performance environment, you will want to disable it. This obviously has pluses and minuses.

Continue reading...