HAProxy in 60 Seconds

  • HAProxy is a popular proxy server and load balancer for TCP and HTTP applications. 
  • As a TCP proxy: It accepts connection on its front-end. Then, it connects to a backend server and attaches the incoming client socket with the outbound backend socket allowing the traffic to flow in both directions.
  • As a load balancer: In TCP mode, it load balances whole connections spreading them across multiple backend servers. In HTTP mode, it can load balance each request.
  • Multiple load balancing algorithms such as round-robin, least recently used backend server etc. are supported. E.g.
   backend userservice-backend
      balance roundrobin
      mode http
      server host1 host1.domain.com:5001 check
      server host2 host2.domain.com:5001 check
  • Health checks are performed to determine if backend servers are available. If a server goes offline, HAProxy will not forward any traffic to it until it becomes online again.
  • ACLs are rules and conditions for incoming requests which are used to make certain decision such as forwarding to a backend or discarding the request.
     acl myrule SOME CONDITION
     use_backend host3.domain.com if myrule
  • Could terminate SSL connections.
  • Alternatives: Nginx, Linux Virtual Servers (TCP only)
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

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

Google+ photo

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

Connecting to %s