eZ Publish, Cache and Performance

eZ Publish is not the fastest CMS I’ve seen. It is flexible (you can define your own classes (type of content), and the fields that define your class. But it seems like « more flexible != fast ». Just take a look at the number of queries on a page that has object relations fields, and you will understand why: it can reach more than 100 queries on a page!

If your eZ Publish is slow (actually even if it’s not slow!!), you should activate eZ Publish caching mechanism. I was looking for some info about eZ Publish, and here is what I found.

Links and notes about Ez Publish caching

  1. http://share.ez.no/articles/ez-publish/ez-publish-performance-optimization-part-3-of-3-practical-cache-and-template-solutions/%28page%29/2
    • This article explains the different cache mechanism (template cache, view cache, preview cache), and the {cache-block} template function
  2. http://ez.no/doc/ez_publish/technical_manual/4_x/features/view_caching/configuring_the_view_cache
    • It explains how to deactivate the view cache on specific pages, by adding the following code at the beginning of the related template:
      {set-block scope=global variable=cache_ttl}0{/set-block}
    • This tip is really useful when you have user session related pages, like a profile page, a cart page…

deactivate eZ Publish cache on ou development environment

These are the settings I usually add to the frontend siteaccesses to deactivate the cache mechanism. Remember to remov them on your staging/test and live environments.

[ContentSettings]
#...(other settings in that section)
#dev only
ViewCaching=disabled
#dev only
PreViewCache=disabled

[TemplateSettings]
#... (other settings in that section)
#dev only
TemplateCache=enabled

[OverrideSettings]
#... (other settings in that section)
#dev only
Cache=disabled

Oh, and also deactivate template caching (in TemplateSettings), your integrators will hate you if you don’t: they would have to clear eZ Publish cache everytime they change a template – using the following command:

php bin/php/ezcache --clear-all --purge