HAProxy running on virtualized environment…

When HAProxy is deployed on VM (such as linode.com) the performance can be decreased even more than 50%. The story behind such behavior is that the packet must be forwarded from HV to VM. Such operations are always heavy (packet is copied into memory, NIC send the interupt, which interrupts VM to HV kernel…) Worst case scenario is when one is using NAT instead of bridged interfaces.

What can you do to get better performance?

First of all understand the kernel parameters and tune them. Below you can find 2 which can have serious impact on number of processed requests:

/proc/sys/net/netfilter/nf_conntrack_tcp_timeout_time_wait (as Willy Tarreau sugests set it to 30secs)

/proc/sys/net/netfilter/nf_conntrack_max

Then go to HAProxy configuration and add

option tcp-smart-accept
option tcp-smart-connect

and restart your instance.

Note that both options are available from HAProxy 1.4

Here you can find more comments on the issue.

HAProxy running on virtualized environment…

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.