Cache management in eZ Publish

Sunday 22 May 2011 6:55:17 am

By : Matthieu Sévère

eZ Publish has a fine-grained caching system that helps achieving high performance web application. Lets review all caching levels that eZ Publish offers and important configuration.

Template compilation

Template compilation is the process of transforming a template file into a PHP file. This compilation can be quite time consuming and is triggered on demand. Thus, TemplateCompile should be enabled in site.ini, the eztc.php can help you to avoid this step by pre-compiling all templates.

View cache

This mechanism stores the generated HTML content of the current module/view. For one node one version of a cache exist for each value of the following : the view mode, the siteaccess, the user role, the pagelayout, view parameters and user preferences. Each version of a cache is stored on file system and served to the client if valid. The cache can be marked as expired when there is a new publication, then the first next call will launch the regeneration process handled by a smart mechanism called Stale Cache.

View cache is one of the key concept of eZ Publish it must be enabled and tweaked.

Depending on your case PreViewcache can be enabled to generate view cache on publish (slows down publication process).

To go further into cache expiration on publish you can dig into Smart view cache cleaning that allows to define relations between content that needs to be cleared on publication.

Cache-block

Cache-block is a template function to define blocks that will be cached in your pagelayout. Each block will store generated HTML in a file. Different version of your cache will be stored depending on the keys you give to a block.

Optimizing cache-blocks is very important as by default cache-blocks expire within 2 hours and on every content publication. Thus, depending on your block you should use ignore_content_expiry to stop expiration on content publication and expiry to define a longer expiration time (zero for no expiration). Note that subtree_expiry can be really use to define expiration on content publication restricted to a given subtree.

System cache

System cache stores system values such as roles settings, translations or settings. They are enabled by default.

HTTP Headers

eZ Publish offers complete control on HTTP headers. Thus, you can define custom cache TTL to tell the client browser to cache the page as static. Note that having control on HTTP headers can be usefull when playing with reverse proxy. 

Varnish and ESI

If eZ Publish cache optimization is not enough or you deployed eZ Publish in cluster mode, which slows down a bit, Varnish can be considered. It's a reverse proxy that integrates smoothly with eZ Publish and offers ESI support.

Varnish is able to store static pages to be delivered at high throughput later on. With the help of eZSI extension you are able to generate ESI tags with eZ Publish to define different cache block refresh within the same page.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 02:21:31
Script start
Timing: Jan 18 2025 02:21:31
Module start 'layout'
Timing: Jan 18 2025 02:21:31
Module start 'content'
Timing: Jan 18 2025 02:21:31
Module end 'content'
Timing: Jan 18 2025 02:21:31
Script end

Main resources:

Total runtime0.0997 sec
Peak memory usage6,144.0000 KB
Database Queries43

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0059 587.9297152.6250
Module start 'layout' 0.00590.0074 740.554739.4531
Module start 'content' 0.01330.0851 780.0078375.5313
Module end 'content' 0.09840.0013 1,155.539115.7031
Script end 0.0996  1,171.2422 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00303.0119150.0002
Check MTime0.00121.2431150.0001
Mysql Total
Database connection0.00101.037110.0010
Mysqli_queries0.040140.2530430.0009
Looping result0.00040.3600410.0000
Template Total0.060861.020.0304
Template load0.00232.264220.0011
Template processing0.058658.757220.0293
Template load and register function0.00010.126510.0001
states
state_id_array0.00090.934110.0009
state_identifier_array0.00121.247920.0006
Override
Cache load0.00191.9556340.0001
Sytem overhead
Fetch class attribute name0.00212.114030.0007
class_abstraction
Instantiating content class attribute0.00000.009130.0000
General
dbfile0.00080.7738100.0001
String conversion0.00000.012240.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplblog_entry/full.tplextension/community_design/design/suncana/override/templates/blog_entry/full.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/header.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/header.tplEdit templateOverride template
11content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
5content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
2content/datatype/view/ezxmltags/emphasize.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/emphasize.tplEdit templateOverride template
1content/datatype/view/ezxmltags/strong.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/strong.tplEdit templateOverride template
1content/datatype/view/ezkeyword.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezkeyword.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 30
 Number of unique templates used: 9

Time used to render debug report: 0.0001 secs