[Zope] Optimisation fun and games

Richard Jones rjones@ekit-inc.com
Mon, 20 May 2002 11:50:58 +1000


On Mon, 20 May 2002 19:39, Bakhtiar A Hamid wrote:
> On Monday 20 May 2002 09:29 am, Richard Jones wrote:
> > We (http://www.ekit.com/) have a popular website, and it's hit fairly
> > hard (around 550k hits since the start of May, and with the summer
> > holidays just starting, we're expecting it to skyrocket). I've therefore
> > been working on ways to get Zope to go as fast as possible. Here's some
> > hints for others who are running (or are expecting to run) high-volume
> > Zope sites:
> >
> > 1) ZEO clients - we have about 9 of them, spread over a number of CPUs.
> > We'll be putting in some more real soon.
> > 2) Two apache frontends using FastCGI to the ZEO clients. They have an
> > on-disk cache which serves up images (using rewrite rules to trap image
> > URLs before they are sent to Zope) meaning Zope can do more important
> > stuff than serve up static binary files. This is currently in testing and
> > halves the average page load time. We don't have a real loadbalancer set
> > up for the apaches, we just serve up different domains (we have many)
> > from each. Watch the max number of connections per apache though - we've
> > had to up it several times. 3) Several uses of RAM caches in Zope - the
> > stylesheet, the sidebar HTML chunk and the front page content HTML chunk.
> > Use the CallProfiler to isolate calls that change very little between
> > users. RAM cache those.
> > 4) CallProfiler'ed up the wazoo. Lots of CallProfiler analysis and fixing
> > of hotspots. We managed halve our average page load time just doing this.
> >
> > Just thought this might be interesting :)
>
> i'd suggest
>
> 5 - squid.  throw in squid and stuff will be served much much faster. off
> course, the pages need to be cacheable i.e with at least Expires field, or
> better yet put out the necessary cache headers.

Yes - we've had a lot of fun coercing stuff so it's cacheable. So on to 6:

6. make stuff cacheable. Put stylesheets and images in an area of your Zope 
that isn't authenticated by cookies. Most browsers won't cache a stylesheet 
if a cookie was sent along with the request. Similarly, don't request stuff 
by HTTPS when you don't need to - not only does the server have to do more 
work, but the client won't cache anything served by HTTPS.

There's a neat tool out there that does cacheability testing:

      http://www.mnot.net/cacheability/


    Richard