[#7018] Performance?

Created By: Kenneth Griffith (kendo451)
Date Submitted: 2011-10-25 15:40

Assigned To:
Resolution: Awaiting Response
State: Open
Detailed Description:
Advanced Content seems to be killing my CMSMS page caching.

This module is my favorite.  But now that it has a zillion features, maybe it's
time to focus on performance.


Date: 2011-10-25 16:59
Posted By: Georg Busch (nan)

Dear Ken,

does this happen with AC 0.9 or an older version?

I know there is much RAM consumption if the Advanced Options Tab is used.
(This is caused by a core function of CMSms. It loads all content of a page
while i just want to get one certain property)
So if you don't need this, disable it since RAM consumption may also slow down
your page since the server needs to swap data to the harddrive.

Do you use smarty in parameter values?
The behaviour of the smarty param has changed in AC 0.9
If you just set this to true it will process all params also in frontend.
So if you need the smarty processing of param values only in backend, set this
param to 'backend'.

I followed your topic in the ShowOff forums. 
Sometime the page is very fast. Sometimes it takes up to 5 seconds.
You say something about 60 db queries. This is quite a lot.
Actually in frontend it shouldn't consume significantly more ressources as the
default contenttype.
I'll see what i can do. But please try to do some investigations and report if
this is really caused by AdvancedContent.
(On small/medium sized pages it woks well but i have not tested it on bigger
sites yet.)
Date: 2011-10-25 17:22
Posted By: Kenneth Griffith (kendo451)

I am going to study it further.  But, you are better able to do it than me, due
to your knowledge.

I already turned off the Advanced tab.  I will see about the smarty param for
back-end only.

The main question is whether it disables or clears the cache every time the page
is loaded.  I have plenty of RAM.
Date: 2011-10-26 10:04
Posted By: Georg Busch (nan)

It disables/clears the cache every time?
It shouldn't do that.
Do you think that because of the low speed/many db querries or did you really
seen that the cache is disabled/cleared?
(directory /tmp/cache/ and /tmp/templates_c/)
When i observed the cache directories while loading several pages on my
localhost using CMSms 1.10 and AC 0.9 the cache was never cleared.

Only in very rare cases (e.g. if AdvancedContent options tab is used and pages
needs to be set to active or inactive) it needs to clear the cache.
But since you don't use that this shouldn't be the issue.

You said you use CGCache and CGSmartImage etc. for caching.
Maybe it is an inproper cooparation between modules and AdvancedContent.
I will try to reproduce this but therefore please give me a list of all
modules/plugins you use in that site and maybe some template snippets and
settings of the modules/plugins.
(if not already described in your forum topic)
I will create a test page to reproduce this.

Stay tuned.
Date: 2011-10-27 03:50
Posted By: Kenneth Griffith (kendo451)

I should have said, the page does not appear to be cacheing.  I did not mean it
clears the cache.

I need to check and see if there are UDT's preventing the page from caching.  I
know that in CMS Made Simple UDT's are called always, instead of being cached.

Also, I am going to switch to a dedicated MySQL server.  I am suspecting that
80% of the performance issue is MySQL.  But, I would like the pages to cache
properly too.
Date: 2011-10-28 04:30
Posted By: Kenneth Griffith (kendo451)

hey guys, from analyzing a number of my sites all on the same host, I have
concluded that 70% of my performance problem is due to database latency inherent
to cloud hosting.

However, I can live with a slow page on the first compile, as long as CMSMS
caching is working for that page, because everyone after the 1st person will get
the page at normal speed.

My sites built with AdvancedContent seem to recompile every page every time. 
I'm now trying to determine if this is because of a UDT I am using, or narrow it
down to AdvancedContent as the source of the problem.
Date: 2011-11-16 06:45
Posted By: Kenneth Griffith (kendo451)

Ok, I think I have found the issue.

AdvancedContent is using the ContentPostRender event.

One effect of using this event is it clears your CMSMS cache for that page (so
any menu template caching, or stylesheets, cge_cache, or anything else that does
caching) will have to regenerate from full on every request.

May I suggest a way to give users of this module an option?

If you put a checkbox option on the Preferences tab to not use
ContentPostRender, then the designer would have to put a tag at the top or
bottom of their template instead.  Like {AdvancedContent}.

Is that reasonable?  The developer of the MultiDomains module just did that for
the same reason.
Date: 2011-11-16 12:24
Posted By: Georg Busch (nan)

Dear Ken,

thanks for your investigations.
If this is really the reason it should be easy to fix it.

Open the file action.safePrefs.php and insert after line 23 right after 


the following  lines:

if(!$this->GetPreference('use_advanced_pageoptions', 0))
	$this->RemoveEventHandler( 'Core', 'ContentPostRender');
	$this->AddEventHandler( 'Core', 'ContentPostRender', false );

Go to the AdminPanel, make sure the "Display AdvancedOptions Tab" option is not
set and just save the preferences again.
This should remove the module from the ContentPostRender event if these options
are not used.
Please tell me if this solves your cache problem.

kind regards.

Updated: 2011-10-25 16:59
resolution_id: => 10