collective.warmup is a tool that allow us to warm up the cache of a website by reading a configuration file and retrieve automatically a series of pages

How to warm up our CMS' cache with collective.warmup

collective.warmup is a tool that allow us to warm up the cache of a website by reading a configuration file and retrieve automatically a series of pages

It is a good practice, when we start up a web application (for instance a CMS), to warm-up the various internal caches of our web application to obtain quick response times from our website.

This is a routine task and can be easily automated to save time: therefore we developed collective.warmup to make this task configurable, maintenable and easily repeatable.

How it works

collective.warmup can be installed as a python package through this command:

$ pip install collective.warmup

Once installed we must create a configuration file containing some webpage URLs, which when invoked will warm-up our caches (choose them carefully):

[warmup]
enabled = True
sleep = 2
base_url = http://abstract.it
logfile = /path/to/warmup.log

urls =
    Home page
   Products

[Home page]
path = /
max_attempts = 2
check_exists =
    Welcome
...


[Prodotti]
path = /products
max_attempts = 2
check_exists =
    Products

now, we can execute the script:

$ warmup warmup.cfg

collective.warmup will read the various parts of the configuration file (Home page, Products… etc.) and it will make an HTTP request for each URL present in the configuration.

After the script has been executed we can analyze the output in its log file (in this case - warmup.log)

At least, we can also execute the warmup script by configuring a CRON task and then we can process the log file with a log analysis system.

Zope/Plone integration (internal cache)

In Plone we have an internal system of cache and it can be warmed up automatically at startup without the need to issue the command manually.

In order to execute the warm-up automatically at the Zope startup we can configure a buildout like this:

[buildout]
...
parts =
   ...
   warmup


[instance]
...
eggs +=
    collective.warmup
environment-vars +=
    WARMUP_BIN ${buildout:directory}/bin/warmup
    WARMUP_INI ${buildout:directory}/warmup.ini


[warmup]
recipe = zc.recipe.egg:scripts
eggs = collective.warmup

Final Thoughts

Publishing a web application needs a series of optimization tasks to make it more accessible to the users and configuring a warm-up process is a necessary step to yield a better service to our customers.

Further information about configuring and installing collective.warmup can be found there:

Help us to make it better

collective.warmup code is on github at this address - https://github.com/collective/collective.warmup - you can help us to make it better by reporting issues or suggesting new features.

You can also share with us your ideas about your deploying experience or let us knowing what you think about collective.warmup.

Share this on

Share |

On same topics

Comments

comments powered by Disqus