High Availability High Performance Web Cache

From Alpine Linux
Revision as of 15:17, 6 February 2011 by Nangel (talk | contribs) (Squid, HAProxy, UCARP Howto - network diagram)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
This material is work-in-progress ...

Do not follow instructions here until this notice is removed.
(Last edited by Nangel on 6 Feb 2011.)


Introduction

This document explains how to use HAProxy and ucarp to provide high performance and high-availability services.

In this document we will use the Squid web cache as the example service. Squid typically uses only a single processor, even on a multi-processor machine. To get increased web-caching performance, it is better to scale the web cache out across multiple (cheap) physical boxes. Although web caching is used as the example service, this document applies to other services, such as mail, web acceleration, etc.

Network Diagram

In the end, we will have an architecture that looks like this:

The workstations all connect to the HAProxy instance at 192.168.1.10. 192.168.1.10 is a virtual IP controlled by ucarp; that is, HAProxy runs on one of the web cache servers at any given time, but any of the web caches can be the HAProxy instance.

HAProxy distributes the web traffic across all live web cache servers, which cache the resources from the Internet.

Benefits

  • The HAProxy server in the diagram is 'virtual' - it represents the service running on any of the web cache servers
  • Each web cache server is configured as a mirror of the others - this simplifies adding additional capacity.
  • HAProxy will ignore servers that have failed or been taken offline, and notices when they are returned to service
  • This configuration allows individual servers to be upgraded or modified in a "rolling blackout", with no downtime for users.
  • Ucarp automatically restarts the HAProxy service on another cache if the server running HAProxy crashes. This is automatic recovery with typically less that 3 seconds of downtime from the clients perspective.