Forums / Developer / Performence issues

Performence issues

Author Message

Pierre Tissot

Thursday 18 October 2007 2:10:44 am

Hello,

My site is under performence problems, I have all the cache settings set:

[ContentSettings]
ViewCaching=enabled
PreViewCache=enabled
CachedViewModes=full;line;sitemap;pdf

[TemplateSettings]
TemplateCache=enabled
TemplateCompile=enabled
TemplateOptimization=enabled

I have put several cache-block in my page layout that expiry in 1 day.

the only thing that is not under cache-block (obviously) is:

{$module_result.content}

But in some of the view templates, the slowest ones, I put the

{set-block scope=root variable=cache_ttl}86400{/set-block}

My site once in under the cache is very fast (0.2 seconds), when not we can wait 5-30 seconds to retrieve a page

Example:

Timing points:

Checkpoint	Elapsed	Rel. Elapsed	Memory	Rel. Memory
Module start 'content'	0.0000 sec	2.7060 sec	0.0000KB	0.0000KB
Module end 'content'	2.7060 sec	2.7119 sec	0.0000KB	0.0000KB
End	5.4179 sec	 	0.0000KB	0.0000KB
Total runtime:	5.4427 sec	

Time accumulators:
 Accumulator	 Elapsed	 Percent	 Count	 Average
ini_load				
Load cache	0.0429 sec	0.7802%	16	0.0027 sec
FindInputFiles	0.0370 sec	0.6720%	16	0.0023 sec

TS translator				
TS init	0.0061 sec	0.1102%	4	0.0015 sec
TS cache load	0.0036 sec	0.0660%	4	0.0009 sec
TS context load	0.0025 sec	0.0452%	4	0.0006 sec
Template Total	5.3781 sec	97.8%	3	1.7927 sec
Template load	0.0163 sec	0.2963%	3	0.0054 sec
Template processing	5.3612 sec	97.4681%	3	1.7871 sec
Template load and register function	0.0004 sec	0.0065%	1	0.0004 sec

override				
Cache load	0.0398 sec	0.7231%	32	0.0012 sec
Matching rules	0.0063 sec	0.1146%	10	0.0006 sec
class_abstraction				
Instantiating content class attribute	0.0625 sec	1.1368%	176	0.0004 sec
Sytem overhead				
Fetch class attribute can translate value	0.0135 sec	0.2452%	13	0.0010 sec
Fetch class attribute name	0.0039 sec	0.0705%	3	0.0013 sec

XML				
Image XML parsing	0.1925 sec	3.5003%	19	0.0101 sec

General				
dbfile	0.0156 sec	0.2833%	175	0.0001 sec
String conversion	0.0011 sec	0.0199%	23	0.0000 sec
Total script time:	5.5004 sec	

Regardless all this after 2 hours the view cache is set invalid and again 5 seconds to build it. Can someone tell me what it's going on? Can I set this 2 hours time to 24 hours (I have a crawler that feeds the cache at nigth) ?

Thx in advance
PiR

André R.

Thursday 18 October 2007 3:25:27 am

Regardless all this after 2 hours the view cache is set invalid and again 5 seconds to build it. Can someone tell me what it's going on? Can I set this 2 hours time to 24 hours (I have a crawler that feeds the cache at night) ?

Viewcache is normally not invalidated by time, so this is probably your cache blocks invalidating (they invalidate every 2 hour unless you specify something else).
To invalidate view cache every 2 hour you would have something like this in your node template:

{set-block scope=root variable=cache_ttl}7200{/set-block}

So you should look into tweaking your cache blocks, remember to not have to many of them, evaluate if you can use subtree_expiry or even ignore_content_expiry to reduce cache invalidation as much as possible. And specify expiry time so that they survive more then 2 hours.

As for performance when stuff is uncached, this is hard to help you with without looking at the code. But rule of thumb is:
* Template code is slow, 10 lines of template code could result in 1000 lines of compiled php code. So rethink any site logic that is controlled by templates and take advantage of the permission / override / content class system if you can.
If not, rewrite any heavy logic to a custom template operator. The php api of eZ publish is far richer then the stuff you have access to in templates, so it is likely that you can do things more efficiently there as well.

* Pay close attention to how many database calls that are made during a uncached request. Any page with over 200 sql calls pr request should be looked at.

* Consider upgrading to eZ Publish 4.0 as soon as it's gold, it will normally give you a performance improvement from 50-200% over what you have, and in some edge case even more.

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