Forums / General / eZ publish performance optimisation FAQ

eZ publish performance optimisation FAQ

Author Message

Alexandre Abric

Tuesday 07 March 2006 7:12:15 am

@Betsy Gamrat > Sorry but I don't see any benefit in this approach compared to the natively supported static cache in eZ.

Betsy Gamrat

Tuesday 07 March 2006 8:49:05 am

You're right, the static cache is the same as preprocessing, however - if there is an instance where you need dynamic content - you can use eZ to deliver the content as PHP or to a PHP application for adaptive high speed delivery.

My approach was to create a dedicated template that extracted the content from eZ and wrote PHP. This was called by a PHP script that further processed it and wrote it out.

Most people will not need to use these techniques - but they allow eZ to support a very high traffic site - delivering dynamic content on the home page and for other sites.

Yvan ROY

Thursday 20 April 2006 2:53:05 am

Hello,

First of all, I am not an eZ Publish expert, but we have been suffering performance issues and we have partly solved them. But maybe there is room for improvement if we share our best practices.

We have drastically improved the performance doing so but maybe we can even go further so I share what we have done and you can comment, add your config files or rectify me.

<b>[Are the templates correctly cached]</b>

Activate the Debug Output for the Template.

If your template is correctly cached you should only see 3 templates loaded:

1/ setup/debug_toolbar.tpl setup/debug_toolbar.tpl design/standard/templates/setup/debug_toolbar.tpl

2/ setup/clear_cache.tpl setup/clear_cache.tpl design/standard/templates/setup/clear_cache.tpl

3/ setup/quick_settings.tpl setup/quick_settings.tpl design/standard/templates/setup/quick_settings.tpl

All other templates listed means that they are **NOT** cached (Thanks to eZ Sytems France for the hint)

<b>[Templates]</b>
Use cache-blocks. You can use cascading cache blocks.

Compile the templates everytime you flush the cache. I did a Cron to make sure the templates were compiled at night.

	cd /var/www/yoursite/
	Php bin/php/eztc.php

<b>[Encoding]</b>

Make sure you use the same encoding everywhere (eg: utf-8).

There is a thread in the forum about that.

<b>[The site.ini file::ContentSettings]</b>

CachedViewModes : "full; sitemap; pdf"
This tells which files should be cached so if you have only « pdf » as we did !! Only PDF files will be cached.

CacheThreshold : 7200
The cache is regenrated every 2 hours

StaticCache : Disabled

<b>[The site.ini file:: DatabaseSettings]</b>
UsePersistentConnection : enabled
This should speed up a bit the database access.

Transactions : enabled
I guess this slows down the speed but it gives more safety.

<b>[The site.ini file:: SearchSettings]</b>
DelayedIndexing :enabled
(make sure you run runcronjobs.php at night to index the new articles)

<b>[The site.ini file:: TemplateSettings]</b>
NodeTreeCaching :enabled
TemplateCompile : enabled
TemplateOptimization : enabled
TemplateCache : enabled
TemplateCompression : Disabled

<b>[The Server]</b>

<b>Hardware requirements:</b>
1 GB of RAM
Fast Hard disk (SCSI recommended)

1/ We have activated hdparm to enable UDMA. By default this is not activated on many distributions.

2/ I installed Zend Optimizer and set it with 128 MB of RAM! Zend Platform tells us that sometimes the Optimizer uses more than 80 MB or RAM!

3/ PHP.ini

- Install Zend Optimizer
- Put 256 MB of RAM for PHP!! (eZ France recommended it)

4/ Logrotate
On certain vhost logs (and others) I have realised that there was not log rotation with I think with a file as big as 200 MB it can be a performance drag every time a new entry is added to the file.

5/ Apache2
<IfModule prefork.c>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 20
MaxRequestsPerChild 0
</IfModule>

<b>[Please ADD recommendations if you have]</b>

6/ MySQL 4.1

Starting from MySQL 4.x there is some caching enabled.

# * Fine Tuning
#
key_buffer = 32M # 16M by default
max_allowed_packet = 16M # 16M by default
thread_stack = 128K # 128K by default
#
# * Query Cache Configuration
#
query_cache_limit = 12M
query_cache_size = 128M
query_cache_type = 1

<b>[Please ADD recommendations if you have]</b>

Yvan ROY

André R.

Thursday 20 April 2006 4:23:18 am

As Denis said ealier in this thread, node.children and parent can avoid a couple of quries.
One exampe of folder, image and galleri templates using this and json to speed up
ez can be found here:
http://ez.no/bugs/view/8093

Yvan!
Do you see better speed with TemplateCompression=Disabled ??
And what impact do you get from turning on Udma ?
And have you tried eaccelerator.net ?

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Yvan ROY

Thursday 20 April 2006 10:10:54 am

Hi André,

Q:Do you see better speed with TemplateCompression=Disabled ??

It 's very hard to know the impact of the performance gain from modifying an option after an option. But regarding TemplateCompression, it says in the documentation that compression has a perfomance drag but that it does save space.

Q:And what impact do you get from turning on Udma ?

As there are lots of disk access from MySQL and Apache with eZ Publish; Udma is recommended. One thing that I have notified using UDMA (along other hdparm options) was a decrease in the system resources especially regarding the process kjounald (the journaling system) that dropped significantly!

Q:And have you tried eaccelerator.net ?

We did, then I switched to Zend Optimizer until I was told this morning to use APC. Therefore I have installed APC but I don't see perfomance gain.

Take care,

Yvan

Paul Forsyth

Thursday 20 April 2006 10:27:16 am

Im not sure TemplateCompression actually works. When i have it on i dont see any compressed templates.

http://ez.no/community/bugs/template_compression_not_working

Theoretically compression can make the reading of templates faster because of their smaller size but it depends on each case...

Paul

Gabriel Ambuehl

Thursday 20 April 2006 10:58:54 am

On a reasonably speced (i.e. enough RAM) dedicated Server, template compression is most likely detrimental as the templates live in cache anyway and are nearly instantaneously available whereas compressed ones need to be decompressed first which is comparably very expensive. And on such servers, I've generally seen eZ be more CPU bound than IO bound (at least with reasonably small databases that still fit into RAM).

On a shared hosting account the picture is less clear.

Visit http://triligon.org

Łukasz Serwatka

Thursday 20 April 2006 12:04:13 pm

@Paul:

Template compression works fine. Just enable it then compare size of dir var/(site)/cache/template/compiled with and without enabled compression. Difference is significant. Check also content of file after compression (don't preview it in MC, which decompress content before preview ;). I think that bug can be closed.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Paul Forsyth

Friday 21 April 2006 1:56:01 am

Ah, they are compressed. Darn editor. I was using 'less' but i didnt realise it decompressed files on the fly if it can... so, yes, reclose that bug. learn something every day, i do... :)

Personally i find the less I/O going on the better. If the CPU can take it then i would switch it on, and off if it cant. This flag does depend on hardware.

Paul

Denis Igin

Thursday 27 April 2006 8:03:56 am

Recent hardware and software (all recent stable versions of LAMP) upgrade in our primary hosting provider multiplied by our 3.7 version migration for all projects solved the speed problem to the extent when no errors occur with a slight yet acceptable delays from 1 to 3 seconds.

We are trying to investigate the major reasons further and locate past bottlenecks whether ours or providers', but it is now clear that timely and all-round upgrade is generally a fix for most problems :)

NXC - OPEN RELIABLE

Bertrand Dunogier

Friday 28 April 2006 3:23:04 am

Hi.

I think that http://ez.no/community/forum/general/ez_publish_article_performance_best_practices has to be part of that great topic !

Bertrand Dunogier
eZ Systems Engineering, Lyon
http://twitter.com/bdunogier
http://gplus.to/BertrandDunogier

Łukasz Serwatka

Wednesday 10 May 2006 1:34:36 pm

Here are 2 useful template functions which helps measure timings and generates statistics:

debug-timing-point
http://ez.no/doc/ez_publish/technical_manual/3_6/reference/template_functions/debugging/debug_timing_point

debug-accumulator
http://ez.no/doc/ez_publish/technical_manual/3_6/reference/template_functions/debugging/debug_accumulator

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Christian Johansen

Monday 03 July 2006 7:11:50 am

Hi, this thread has been very helpful in speeding up my general access pages. They still lag a little bit too much when they're not cached, but it's getting better. However, publishing is starting to become a real pain. I was hoping someone could offer some insight as my admin interface is very slow. See this example - this is from viewing Content Structure only:

Time accumulators:
 Accumulator	 Elapsed	 Percent	 Count	 Average
ini_load				
Load cache	0.4961 sec	4.3630%	12	0.0413 sec
FindInputFiles	0.1142 sec	1.0044%	12	0.0095 sec
Parse	0.0147 sec	0.1295%	2	0.0074 sec
Save Cache	0.0101 sec	0.0886%	2	0.0050 sec
Mysql Total				
Mysql_queries	2.3232 sec	20.4304%	739	0.0031 sec
Looping result	0.0898 sec	0.7896%	735	0.0001 sec
Template Total	10.8045 sec	95.0%	2	5.4023 sec
Template load	0.1505 sec	1.3238%	2	0.0753 sec
Template processing	10.6532 sec	93.6862%	2	5.3266 sec
override				
Cache load	0.1080 sec	0.9499%	2	0.0540 sec
General				
INI string conversion	0.0006 sec	0.0054%	2	0.0003 sec
String conversion	0.0002 sec	0.0014%	2	0.0001 sec
Total script time:	11.3711 sec	

That's probably hard to read but, the last line says it all - 11 seconds! That's way too much just to view things. When publishing an article it usually takes 30-60 seconds. Here's the details:

CPU: 2,4GHz Celeron
Memory: 512M
Disk space: about 30GB free

OS: Win XP
SQL: MySQL 4.1
WebServer: Apache 2
PHP: 4.4.0
Accelerator: eAccelerator with eaccelerator.shm_size="256"
eZ Version: 3.7.4

Site.ini
[ContentSettings]
ViewCaching=enabled
PreViewCache=disabled # Slows down publishing don't it?

[TemplateSettings]
TemplateCache=enabled
TemplateCompile=enabled
TemplateCompression=disabled # caused me trouble before
TemplateOptimization=enabled

[SearchSettings]
DelayedIndexing=enabled # In fact, we don't use the search engine at all

I also switched the default tree menu with enhanced Ajax treemenu, extension called ezodcsm, saves a bit of time

From what I can gather, this should be the recipy for a relatively successful installation, however, with around 1000 nodes, the admin is becoming increasingly hard to work with. Any hints?

André R.

Monday 03 July 2006 7:43:07 am

try the "[AJAX-TreeMenu] On demand tree menu"

http://pubsvn.ez.no/community/trunk/extension/ezodcsm/branches/virtual_folders/

it is known to reduce load times on larger eZ installations(many objects).

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Christian Johansen

Monday 03 July 2006 11:56:45 pm

As I wrote I already use this extension. The problem however is more with the publishing and waiting times for POST requests in general. I really don't know what to do.

Łukasz Serwatka

Tuesday 04 July 2006 12:01:32 am

In your case template processing takes 10s. Do you have any complex template code structures? How big is your content structure tree? Perhaps you should reduce amount of presented items using contentstructuremenu.ini

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Christian Johansen

Tuesday 04 July 2006 4:02:45 am

Well, I have reduced the number of nodes being fetched by using the ezodscm extension which replaces the content structure menu with an AJAX one. It's working fine. I haven't introduced any complex template code to the admin siteaccess. It's the standard admin design.

Yann Rouillard

Friday 18 August 2006 4:57:01 am

I have a little question to Yvan ROY comment about template cache.
Does his comment imply we should only see 3 "Loading template ... with resource ..." line in the debug output ?

I see this line for each template used in the page and I thought this was normal.
Is this the case and what should I check it if means templates are not correctly cached (Template cache option are enabled) ?

From Yvan ROY:

[Are the templates correctly cached]

Activate the Debug Output for the Template.

If your template is correctly cached you should only see 3 templates loaded:

1/ setup/debug_toolbar.tpl setup/debug_toolbar.tpl design/standard/templates/setup/debug_toolbar.tpl

2/ setup/clear_cache.tpl setup/clear_cache.tpl design/standard/templates/setup/clear_cache.tpl

3/ setup/quick_settings.tpl setup/quick_settings.tpl design/standard/templates/setup/quick_settings.tpl

All other templates listed means that they are **NOT** cached (Thanks to eZ Sytems France for the hint)

Marko Žmak

Friday 18 August 2006 5:15:12 am

Here are some suggestions links for optimization:

http://ez.no/community/forum/developer/php_modules_needed_fo_ez_3_8_1
http://ez.no/community/forum/developer/static_cache_some_user_report_tips
http://ez.no/community/forum/setup_design/improving_ez_publish_environment_and_performance

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Denis Igin

Wednesday 30 August 2006 1:53:09 am

Two more server configuration articles by Bård Farstad that might influence performance:

Clustering in eZ publish 3.8 http://ez.no/community/articles/clustering_in_ez_publish_3_8
Server Architecture for eZ publish Hosting http://ez.no/community/articles/server_architecture_for_ez_publish_hosting
Tuning MySQL for eZ publish http://ez.no/community/articles/tuning_mysql_for_ez_publish

---

This thread has been providing a source of comprehensive perfomance guidelines as a result of our common efforts. Some checklists and overview articles were created along the way on the topic. My suggestion now would be to allocate a permanent place for this info and keep on adding to it.

For example, it can be a stand along chapter 'Performance optimisation' in http://ez.no/doc/ez_publish/technical_manual/3_8/installation , divided into specific topics such as server-side configuration, eZ configuration, templates, etc.

Anyone from eZ crew with access to this area supports the idea?

NXC - OPEN RELIABLE