Notes on HAProxy Configuration


The primary objective of a load balancer is:

  • acting as a reverse proxy (exposing an IP and hiding server implementation behind a backend IP).
  • Load balancing and higher availability with multiple backend servers
  • Request queuing

The most four basic sections of an HAProxy configuration are:

  • Default
  • Frontend
  • Backend
  • Global

All the sections are similar to Nginx config. The interesting thing is layer 4 or layer 7 routing of requests to backend servers. Layer 4 is TCP based and layer 7 is the application layer, based on HTTP. A health check with layer 4 is a successful TCP connection of HAProxy with a backend server. A layer 7 health check is a successful response of an HTTP API (HEAD/GET). The latter is slower but smarter.

HAProxy Logs & Config
  • /var/log/haproxy.log
  • /etc/haproxy/haproxy.cfg

Leave a Reply

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

You are commenting using your 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.

%d bloggers like this: