Licence |
Load balancing for Zope using ZEO (updated)A client site has been so successful that they need to scale, and quickly. For anyone finding themselves in such a position, "this document":http://www.upfrontsystems.co.za/Members/jean/optimizing-plone on optimising Plone is a good place to start. Load balancing seems the optimal solution, given that it can be done with minimal downtime and will increase availability. The main options seem to be "mod_backhand":http://www.backhand.org/mod_backhand/ , "Pound":http://apsis.ch/pound/ and "Squid":http://www.squid-cache.org/ . But as ever, the devil is in the details. Hoping to fill the gaps left in what is some otherwise great documentation, I've collected a few resources together for those wanting to set up a ZEO cluster to scale their Zope/Plone site.
First of all, one is confronted with a choice between three options
which all seem to take different approaches. So which to choose?
Option One - SquidIn this thread Andreas Jung suggests that "[y]ou should think about using Squid as reverse proxy when your content is mostly static...this will improve your performance significantly and reduce your costs for ZEO clients." That suits our client's situation. If not, then Pound would be a good choice for those who want minimal configuration and can live with static routing. Mod_backhand has the advantage of being Apache based, so that mixed Zope/Static sites can live happily together, and operates per-request rather than per-connection. Note that you could run Pound behind Apache though in this situation.If you choose Squid, then this document seems to be the authority on how to get the most out of it for ZEO. Plone.org also has a set of links collated on Squid/Plone integration. Option 2 is the one you will want, as Squid will treat ZEO servers as cache peers and you thus get free access to all of its more sophisticated load balancing gear (which doesn't seem to require any configuration out of the box to have a fairly acceptable solution - however, if you want to get tricky then you can). Now one thing which isn't mentioned above is how to get the redirection (think Apache RewriteRules) working in Squid. There are a few references to redirect_program (the need to set it), but few examples. Not to fear. Thanks to a presentation by Andy McKay on Profiling, Benchmarking and Caching in Plone, I found the program SquidGuard which appears to fulfil this requirement. Here is the line for squid.conf: redirect_program /usr/bin/squidGuard -c /etc/squid/squidGuard.conf And an example SquidGuard configuration: dbhome /var/lib/squidguard/dbAnd a note: ensure cache headers are being set. So that seems to clear the way to implement a ZEO cluster using Squid which allows for VirtualHosts. Now it is just a matter of getting it up and running :) Option 2: Apache + Pound + ZEOThe previous configuration at our client site has been:[Apache] -> [ZEO Client] -> [ZEO Server] So, rather than learning about Squid and reconfiguring everything, it seems easier to add in Pound between Apache and the ZEO Client(s). One thing which was initially a little bit mistifying about this whole load balancing thing was how to send the URL information through Pound to ZEO. But of course, Pound simply forwards a request for a particular URL to the ZEO client so it was in fact easier than you might think. The result of the initial Apache RewriteRule looked something like this: http://localhost:8080/VirtualHostBase/http/www.clientsite.com/Plone/VirtualHostRoot/$1 Running Pound on port 81, the new resultant URL was: http://localhost:81/VirtualHostBase/http/www.clientsite.com/Plone/VirtualHostRoot/$1 Configuring PoundAll Pound needed to do was select one of 3 ZEO clients, forward on the request and forward back the response. This was the configuration we went with, saved in /usr/local/etc/pound.cfgListenHTTP *,81One final tidbit I picked up was the following script to make pound into an init.d service: #! /bin/sh (Note that at the time of writing, I haven't tried this yet, but it came from the Pound mailing list and looks promising). That's true but ...
Posted by
antonh
at
09-Feb-05 04:52 PM
If you want to use the Virtual Host Monster with anything more complicated than simple mappings then you do need something like Apache rewrites. I've actually decided to leave that to Apache and let Pound or Squid handle the load balancing.
That's true but ...
Posted by
Anonymous User
at
10-Mar-05 08:21 AM
Couldn't agree more - in my case apache does all the job redirecting stuff properly (constructing urls to utilize VHM) and all squid does is reverse-cache and load balancing. Works quite good and simple to manage - Need another virtual host? - add new apache virtual host with appropriate rules for proxy/rewrite and that's it - one spot for config and one thing to break. Once squid is running you don't have to even remeber about it :)
|
No need for redirector