2008-01-15

Apache Round Robin for ZeoClients

There is a common approach to running Plone/Zope behind some service that distributes requests across numerous ZeoClients. Here's how I have been doing it using Apache (2.2.x).



________Zeoclient(6968)
| _______ZeoClient(6969)
client-->varnish(80)-->apache(81)|<_______ZeoClient(6970)
|________ZeoClient(6971)


Everybody knows how to setup varnish, right? So I am only going to show the Apache bits here.

First you need a rewrite map.


#zopeservers.map
ALL localhost:6968|localhost:6969|localhost:6970|localhost:6917


Of course there can be more or less hosts in the map and they don't have to be all localhost either.

Next you need to enter the right stuff in the apache configuration. As here in a VirtualHost.


<VirtualHost *:81>
...
RewriteMap zopeservers rnd:/usr/local/apache2/conf/zopeservers.map
RewriteRule ^/(.*) \
http://${zopeservers:ALL}/VirtualHostBase/http/%{SERVER_NAME}:80/ploneroot/VirtualHostRoot/$1 [L,P]
...
</VirtualHost>


How does Emiril say... BAM!

Not so hard at all. A couple of notes:

1. I don't think apache knows how to detect if a client is down or broken. So it will serve up all the errors it gets.

2. Varnish doesn't cache https, so it needs to be handled wihtout varnish...

No comments: