general load balancing issues

Clement Laforet sheepkiller at cultdeadsheep.org
Mon Dec 15 05:02:09 PST 2003


On Mon, 15 Dec 2003 12:46:52 +0100
Bogdan TARU <bgd at icomag.de> wrote:
 
Hi !
>  Right now I am considering a setup with one common NFS repository for
>  the configuration files, Apache binaries, Web content and temp
>  directory for PHP, NFS resource which will be mounted on all the
>  'front' webservers. I am wondering, though, if I will be able (by
>  having one common temp directory for PHP) to load-balance the domains
>  involving sessions: will the sessions be lost when connsecutive hits
>  go to different webservers, or not? 

If I were you, I would consider a 3-tier architecture


                  /----------+
                 /           |
                /        +-------+
    +----------+         |  web  |        +----------+
----|   Load   |         |servers|--------|NFS server|
    | balancer |         |  pool |        +----------+
    +----------+         |       |
                \        +-------+
                 \           |
                  \----------+

Concerning PHP session, a HTTP reverse-proxy can easily do the trick.
If you don't want to spend a lot of time on configuring apache as
reverse proxy, you can use some flexible and easy-to-use dedicated
software.
Here's my favorite:
1. pound (${PORTSDIR}/www/pound}
pound can handle URI based sessions to redirect request to the correct
backend server. It support SSL too.

2. haproxy (${PORTSDIR}/net/haproxy)
haproxy is less intuitive than pound, but more flexible.
It DOES NOT support SSL.

Both support backend failures.
Since thay acts like proxy, you don't have to reconfigure your network
(but I recommend it)

To grab real IP address on your apache server you must use (and
configure carefully) mod_extract_forwarded{2} or mod_rpaf{2}.

If you don't want to use a reverse proxy, Matthew Seaman's solution
looks the best.


clem


More information about the freebsd-hackers mailing list