CacheFu 1.0 Manual

« Return to page index

CacheFu 1.0 is designed to work with with Plone 2.1 - 2.5 and Squid 2.x.

1. Installation

Ready to install CacheFu? Dive in.

1.1. Preparing and Configuring Zope and Plone for Caching

All configurations require some software to be installed into Zope and Plone, and it is recommended that you at least step through the configuration tool.

1.1.1. Downloading and Installing CacheFu itself

The first step in CacheFu-ing your site is to get the products into Zope.

There are many caching configurations for CacheFu, some requiring extraneous software such as Squid and Apache which are external to Zope and Plone, but always relying on the Zope and Plone addons which manage caching policies for content, skins, etc..  To begin on your journey, download the latest release of CacheFu from here, extract it, and copy, move, or symlink these folders into your $INSTANCE_HOME/Products/ folder:

  • CacheSetup/
  • CMFSquidTool/
  • PolicyHTTPCacheManager/
  • PageCacheManager/
Make sure not to copy MemcachedManager in, as it is still experimental and not considered a part of the main CacheFu setup.

Now that you have code available to Zope and Plone which can be used to set and manage your policies and other cache settings, restart Zope.  In a default source install of Zope, you would run this as root, zope, or whatever user you have Zope running as:

    $INSTANCE_HOME/bin/zopectl restart

You should be able to follow a link titled "site setup" either in the upper right corner, or the personal bar near your user name, to the QuickInstaller, which you'll see as "Add / Remove Products".  Tick the box next to CacheSetup, no others, and hit the "install" button.

Now you're ready to move on and make some decisions about your overall caching strategy.  You should already see some performance improvement in your site from the default page cache configuration, which caches page output in Zope memory, and the aggressive browser caching settings.

1.1.2. Choosing a base configuration

Based on your needs, available resources, and level of skill and experience, you'll need to make some decisions about what caching configuration to start with in your portal.

When you enter the Cache Configuration Tool in your portal's control panel, you are, first and foremost, presented with four options for a base caching config:

Zope only
This configuration is the simplest, will work with any site, and implements aggressive browser caching policies as well as enabling both of the Zope RAMCache solutions provided by CacheFu, the Page Cache and the Macro Cache, which we will cover in more detail later.
Zope behind Apache
This configuration is the most common, usually on systems where some sites are hosted by Apache and some by Zope.  Apache can also be used to control many aspects of HTTP Serving, and even for caching with mod_cache, mod_disk_cache, and a new module called mod_wodan, which we will cover later.
Zope behind Squid
This has shown the best performance of all supported configurations, can be very simple to configure, and is ideal for sites which are entirely served out of Zope / Plone.
Zope beind Squid behind Apache
This configuration is both the most complicated and the most convenient to integrate with hybrid legacy configurations, and performs comparably to Zope behind Squid.
If you are not on a UNIX or Linux system, you may have more trouble getting Squid running than the rest of us, but it should be possible.  It is also possible that CacheFu could work with another HTTP Proxy which implements a sufficient subset of the functionality leveraged in CacheFu.  Over time, hopefully CacheSetup will become even more flexible and have Out-Of-The-Box (OOTB) support for even more configurations.

1.2. Configuring external server software

Some CacheFu configurations involve external server software which must be carefully configured to integrate well and perform optimally. Herein lie some of the secrets.

1.2.1. Installing and Configuring the Squid Caching Proxy Server

Squid is really the cornerstone of today's CacheFu, and should not be much trouble to get working if you carefully follow our instructions.

There are many ways to install Squid on your server, depending upon OS vendor, platform, and preference.  Installing from source is relatively straightforward on most UNIX and workalikes such as GNU/Linux, but I avoid it when packages are available, such as on RedHat Enterprise Linux, Debian GNU/Linux, etc.. Instructions for building Squid from source may be found here.  Ignore the sections about customizing squid.conf, as CacheFu includes a script for automatically generating this and other supporting configuration files where relevant.

In order to generate your config, go to the 'squid' subfolder of your CacheFu installation, or 'CacheFuDocumentation/squid' if your CacheFu comes from the Plone 2.5 release, and edit the 'Makefile' and 'squid.cfg' files to reflect your environment.  Always keep in mind that it is imperative for you to use this generated configuration, making as few direct modifications to the generated configs as possible, if any.

Once you are happy with your base configuration, simply run 'make' from within the 'squid' directory, and then change directory to 'output', or whatever you have set your output directory to be, where you will run './deploy' as root.