Caching problems

Author Message

Oliver Frommel

Saturday 06 October 2007 5:09:50 am

Hello,

we have some caching problems on our sites I wanted to solve with
Smart View Caching. Unfortunately this did not work out as expected.
It is a fairly standard situation with news items buried somewhere in the storage hierarchy but supposed to show up on the homepage as well.

I put the following lines in the viewcache.ini.append.php of the admin siteaccess of the site (using the admin siteaccess is the right place, isn't it):

[ViewCacheSettings]
SmartCacheClear=enabled

[lmi_news]
AdditionalObjectIDs[]
AdditionalObjectIDs[]=14877

'lmi_news' is of course the class identifier of the news objects. 14877 is the node id of the homepage. According to the documentation I think this should work. Being unsure i tried the following block as well:

[lmi_news]
DependentClassIdentifier[]
DependentClassIdentifier[]=lmi_startpage
ClearCacheMethod[]
ClearCacheMethod[]=object
ClearCacheMethod[]=parent
AdditionalObjectIDs[]
AdditionalObjectIDs[]=14877

This did not change anything however. The news show up in the corresponding folder but not on the homepage. The pagelayout.tpl has two cache blocks with
keys=$module_result.uri. The template of the actual homepage has no cache blocks at all. However i tried to set the TTL with {set-block scope=root variable=cache_ttl}0{/set-block} as proposed in the thread http://ez.no/developer/forum/developer/view_cache_trouble.

I am unsure about how and when to make use of Smart View Caching in general and how it corresponds with cache blocks and the TTL. For instance the documentation says that cache-blocks are meant to be used in pagelayout.tpl but it might be used in other templates as well. I don't understand how cache-blocks relate to view caching, smart view cache cleaning and vice versa.

I think I read most of the documentation but I still can't get it to work.

Thanks for your help
Oliver

 

Petr Mifek

Saturday 06 October 2007 9:32:24 am

At first sight, I think the ini should be either in the siteaccess, where the news doesn't showed up, or in the override. The admin siteaccess is problably not the right place for this. There may be additional problems in the config, but this one is obvious after brief reading your message.

Good luck!

Damien Pobel

Saturday 06 October 2007 3:41:19 pm

Hi,

I think Petr is right, you should put your viewcache.ini.append.php in settings/override instead.
But if your lmi_news on the homepage are shown using the pagelayout templates (or an include in it) the Smart Cache Clear will not solve your problem as it only concerns the cache of $module_result.content [1].
If you have a cache-block around the template code that fetch your lastest lmi_news you should check the subtree_expiry parameters of cache-block [2].
You can find a good example in "eZ Publish Performance Optimization Part 3 of 3: Practical Cache and Template Solutions" [3]

[1] http://ez.no/doc/ez_publish/technical_manual/3_9/features/view_caching
[2] http://ez.no/doc/ez_publish/technical_manual/3_9/reference/template_functions/miscellaneous/cache_block
[3] http://ez.no/developer/articles/ez_publish_performance_optimization_part_3_of_3_practical_cache_and_template_solutions

Damien
Planet eZ Publish.fr : http://www.planet-ezpublish.fr
Certification : http://auth.ez.no/certification/verify/372448
Publications about eZ Publish : http://pwet.fr/tags/keywords/weblog/ez_publish

Oliver Frommel

Sunday 07 October 2007 1:23:56 am

hmm, I had the same settings in the regular siteaccess before and it didn't work. So i tried to put it in the admin access as described here:

"make sure the "viewcache.ini.append.php" file located in the "settings/siteaccess/example_admin" directory (replace "example_admin" by the name of the siteaccess that is used for adding and editing content) contains the following lines:
[ViewCacheSettings]SmartCacheClear=enabled"
http://ez.no/doc/ez_publish/technical_manual/3_9/features/view_caching/smart_view_cache_cleaning

This also seems to make sense, so i tried it. However I had no success with both approaches.

Thanks for your hints
Oliver

Xavier Serna

Monday 08 October 2007 12:34:53 am

Hi all,

the viewcache settings must be set in the siteaccess used to publish content (usually admin siteaccess). And in the AdditionalObjectIDs array I believe that must be specified the ObjectID of the home, not the NodeID.

hth!

--
Xavier Serna
eZ Publish Certified Developer
Departament de Software
Microblau S.L. - http://www.microblau.net
+34 937 466 205

Petr Mifek

Monday 08 October 2007 12:57:01 am

Xavier is right. Today I've checked some our configs and it the problem seems to be in the >Object<ID. I've been thinking in multisite-ezwebin's context... Sorry for misguiding you.

Good luck!

Oliver Frommel

Tuesday 09 October 2007 4:50:29 am

Ok, I guess using the admin site access and object ID will be ok. Thanks for your help.

However it still doesn't work although I tried virtually every combination of settings in the viewcache.ini and different cache-blocks in the template. For instance using a {cache-block expiry=120} around the template fetch and display code for the news items as a brute force approach didn't work either.

Could it be a problem with our setup? With this site we have two different site accesses 'sa1' and 'sa2' sharing the content and most of the templates, too. The templates for the homepage differ though. That means we have two templates 'startpage1.tpl' (for sa1) and 'startpage2.tpl' (for sa2). We have only one admin site access for both sites - and thus only one viewcache setting as well. Is it possible that the caching of one site access intereferes with the other?

I tried both, using the same cache directory for both sites (say var/cache_sa1), and using a separate cache directory each site (say var/cache_sa1 and var/cache_sa2). What is the right approach?

Thanks
Oliver

Xavier Serna

Tuesday 09 October 2007 7:21:01 am

What eZ version are you trying with? Forgot to mention that AdditionalObjectIDs settings is available only in >3.9.0.

Also, along with the AdditionalObjectIDs setting you must specify the clearcachemethod, in your case 'object' would be ok.

And, for the var/cache issue, if both siteaccess are sharing the same db, it's ok to use the same var dir, not sure but perhaps for all this to work, this is a must.

More info can be found here:
http://ez.no/doc/ez_publish/technical_manual/3_9/features/view_caching/smart_view_cache_cleaning

hth!

--
Xavier Serna
eZ Publish Certified Developer
Departament de Software
Microblau S.L. - http://www.microblau.net
+34 937 466 205

Oliver Frommel

Tuesday 09 October 2007 9:30:26 am

This is all fine and dandy: We are using eZ Publish 3.9.2.

I also read the documentation you pointed me too but still don't get it :) In my opinion the docs should be a bit more clear, maybe even more formal to point out what directives are required and which are optional and which combinations are, too.

For instance if you take a look at Example 5 you will see that they are using the AdditionalObjectIDs without a clearcachemethod. It might be somewhere else in the imaginary ini file buw how knows. Or am I missing something?

Anyway thanks a lot for your help.
Oliver

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 11:40:43
Script start
Timing: Jan 18 2025 11:40:43
Module start 'layout'
Timing: Jan 18 2025 11:40:43
Module start 'content'
Timing: Jan 18 2025 11:40:44
Module end 'content'
Timing: Jan 18 2025 11:40:44
Script end

Main resources:

Total runtime1.0584 sec
Peak memory usage4,096.0000 KB
Database Queries79

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0125 587.7969152.6094
Module start 'layout' 0.01250.0034 740.406339.4141
Module start 'content' 0.01591.0409 779.8203702.6406
Module end 'content' 1.05670.0016 1,482.460924.1875
Script end 1.0583  1,506.6484 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.2981160.0002
Check MTime0.00130.1194160.0001
Mysql Total
Database connection0.00570.538410.0057
Mysqli_queries0.967991.4518790.0123
Looping result0.00080.0802770.0000
Template Total1.016796.120.5084
Template load0.00200.188020.0010
Template processing1.014795.875520.5074
Template load and register function0.00030.029810.0003
states
state_id_array0.00110.100610.0011
state_identifier_array0.00200.191820.0010
Override
Cache load0.00180.1694800.0000
Sytem overhead
Fetch class attribute can translate value0.00080.076440.0002
Fetch class attribute name0.00130.1230110.0001
XML
Image XML parsing0.00170.158540.0004
class_abstraction
Instantiating content class attribute0.00000.0023120.0000
General
dbfile0.00100.0953220.0000
String conversion0.00000.000940.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.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
9content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
22content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
13content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 49
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs