Tuesday, October 30, 2007

Load Balancing Apache Servers on Debian with HAProxy/Keepalived

A fine article shows you how to set up a two-node load balancer in an active/passive configuration with HAProxy and keepalived on Debian Etch.

Not only does the load balancer distribute the requests to the two backend Apache servers, it also checks the health of the backend servers. If one of them is down, all requests will automatically be redirected to the remaining backend server. In addition to that, the two load balancer nodes monitor each other using keepalived, and if the master fails, the slave becomes the master, which means the users will not notice any disruption of the service. HAProxy is session-aware, which means you can use it with any web application that makes use of sessions (such as forums, shopping carts, etc.)

From the HAProxy web site: "HAProxy is a free, very fast and reliable solution offering high availability, load balancing, and proxying for TCP and HTTP-based applications. It is particularly suited for web sites crawling under very high loads while needing persistence or Layer7 processing. Supporting tens of thousands of connections is clearly realistic with todays hardware. Its mode of operation makes its integration into existing architectures very easy and riskless, while still offering the possibility not to expose fragile web servers to the Net." http://www.howtoforge.com/haproxy_loadbalancer_debian_etch

2 comments:

  1. great article on load-balancing a website. But what about syncing the webservers? How do the webservers' content kept in sync?

    ReplyDelete
  2. @anonymous

    For starters static html content can be kept in sync with rsync cron jobs. Using NFS, OCFS2 should be good alternatives (See scaling drupal step one - a dedicated data server

    ReplyDelete

You can leave a comment here using your Google account, OpenID or as an anonymous user.

Popular Posts