Speed up your CMSMS site
Speed up your CMSMS site
Hello,
Here is a method to speed up your CMSMS site considerably.
I have hacked the index.php to implement full page cache. The entire page is cached, not just the content. This has improved page loading time by almost 50% to 80% for me.
I am very new to CMSMS. So let me know if a better solution already exists.
Note: This is meant for version 1.0.4 only. It might work on 1.0.5 also, but haven't tested.
Regards,
Jatinder Singh Thind
[gelöscht durch Administrator]
Here is a method to speed up your CMSMS site considerably.
I have hacked the index.php to implement full page cache. The entire page is cached, not just the content. This has improved page loading time by almost 50% to 80% for me.
I am very new to CMSMS. So let me know if a better solution already exists.
Note: This is meant for version 1.0.4 only. It might work on 1.0.5 also, but haven't tested.
Regards,
Jatinder Singh Thind
[gelöscht durch Administrator]
Last edited by jatinder on Fri Apr 13, 2007 3:31 am, edited 1 time in total.
Re: Speed up your CMSMS site
Well, cyberman has got his cache tags: http://dev.cmsmadesimple.org/projects/cache
Your and Cyberman's solution are nice and fast, however, they have disadvantages, a) news pagination or other pages which have 'visible' variables in the URL have no more working links (next/prev)(at least your solution, I can't remember the cache plugin behaviour now), b) hard lifetime. Can't even set the page not to be cached.
Fast though...
Your and Cyberman's solution are nice and fast, however, they have disadvantages, a) news pagination or other pages which have 'visible' variables in the URL have no more working links (next/prev)(at least your solution, I can't remember the cache plugin behaviour now), b) hard lifetime. Can't even set the page not to be cached.
Fast though...
Re: Speed up your CMSMS site
Cyberman's cache module only caches the {content} portion.
I used the code from his module to cache the whole page.
Any page which has variable "mact" in the $_REQUEST is not cached. My guess was that "mact" in only present when a module is being called. Though I can't be sure, I haven't worked on CMSMS that much.
I can't find a way to implement pagination in News module. How you do it?
Can you let me know which module won't work with the modified index.php so that I can try to come up with a solution?
I used the code from his module to cache the whole page.
Any page which has variable "mact" in the $_REQUEST is not cached. My guess was that "mact" in only present when a module is being called. Though I can't be sure, I haven't worked on CMSMS that much.
I can't find a way to implement pagination in News module. How you do it?
Can you let me know which module won't work with the modified index.php so that I can try to come up with a solution?
Re: Speed up your CMSMS site
Dear Jatinder,
I like all efforts to make release full page caching. You remind me of my poor "write(urlfilename, renderedpage) instead of echo renderedpage" in http://forum.cmsmadesimple.org/index.ph ... l#msg37558
v2.0 has it already, according to http://blog.cmsmadesimple.org/2007/02/0 ... your-help/
I'm sure Ted will welcome new devs to help the release of v2.0. Or even a lighter-than-expected v2.0 with "what is done so far", if technically possible, should it be called v1.5 ?
Pierre M.
I like all efforts to make release full page caching. You remind me of my poor "write(urlfilename, renderedpage) instead of echo renderedpage" in http://forum.cmsmadesimple.org/index.ph ... l#msg37558
v2.0 has it already, according to http://blog.cmsmadesimple.org/2007/02/0 ... your-help/
I'm sure Ted will welcome new devs to help the release of v2.0. Or even a lighter-than-expected v2.0 with "what is done so far", if technically possible, should it be called v1.5 ?
Pierre M.
Re: Speed up your CMSMS site
Look here: http://wiki.cmsmadesimple.org/index.php ... fined_Tagsjatinder wrote: I can't find a way to implement pagination in News module. How you do it?
and you may like pagination for backend: http://forum.cmsmadesimple.org/index.ph ... 194.0.html
It's just the permanent cache. The pagination of News doesn't work, and the content is not updated immediately (sigh).jatinder wrote: Can you let me know which module won't work with the modified index.php so that I can try to come up with a solution?
I can't wait for v2.0

Re: Speed up your CMSMS site
Oh yes, it doesIt's just the permanent cache. The pagination of News doesn't work, and the content is not updated immediately (sigh).

I will check with the pagination though. Thanks for the link.
Re: Speed up your CMSMS site
That would be nicejatinder wrote: Oh yes, it does. I have another hack for the admin section which deletes the cache file when a page is updated.


I turned off 'pretty urls' and looked at the 'mact' variables. The pagination doesn't use it, that's apparently why it's loading the cache.
Updated index.php
I have made another modification to the index.php page. The pages are now cached only when they are marked as "Cachable".
So I guess even News pagination should work now if you set the particular page as non cachable. Can somebody please confirm this?
I am also posting the modified admin/editcontent.php script. This script includes a single line modification, which deletes the cache file when a page is updated.
[gelöscht durch Administrator]
So I guess even News pagination should work now if you set the particular page as non cachable. Can somebody please confirm this?
I am also posting the modified admin/editcontent.php script. This script includes a single line modification, which deletes the cache file when a page is updated.
[gelöscht durch Administrator]
Re: Speed up your CMSMS site
Great! Just a little modification/fix:
You can leave the caching for modules now (it seems it's not much a difference, but better than nothing), and it doesn't output warnings when updating a content which hasn't been cached yet (see both attached files).
[edit] Fix to fix
(jatinder, the content_alias instead of content_id was being encrypted in editcontent.php - so it wasn't working)
[edit]Oh, and know you should have your menu template already sorted out - it caches it. The same goes with all other templates. However, adding new content/menu items is not a problem.
[gelöscht durch Administrator]
You can leave the caching for modules now (it seems it's not much a difference, but better than nothing), and it doesn't output warnings when updating a content which hasn't been cached yet (see both attached files).
[edit] Fix to fix

[edit]Oh, and know you should have your menu template already sorted out - it caches it. The same goes with all other templates. However, adding new content/menu items is not a problem.
[gelöscht durch Administrator]
Last edited by Vin on Sat Apr 14, 2007 9:37 pm, edited 1 time in total.
Re: Speed up your CMSMS site
I tried the last posted version (by Vin) on a site based an 1.04 (german) . I found that the last lines are in double:Vin wrote: Great! Just a little modification/fix:
--
echo 'BackUrl().'">« '.lang('back').'';
include_once("footer.php");
# vim:ts=4 sw=4 noet
?>
--
Unfortunately, no page is cached anymore. The 'cachable' checkbox is cheched on every page. Maybe something went wrong during the last fixes?
Another suggestion: could you please modify the comment "Generated in xxx seconds ..." to clarify that the page is generated from cache? Could be line 212 in index.php
Thanks for you work. Using your modified code (from yesterday) speeds up my site by 80% and more.
Re: Speed up your CMSMS site
I have the feeling it collided with the 'timer' of Jatinder. It should be fixed by now. Yet another update (with the cached notice) (NOW SWITCH THE CACHE OFF IN THE CASE OF MODULE (It's not much difference after all)):
P.S.
[gelöscht durch Administrator]
P.S.
What do you mean?echo 'BackUrl().'">« '.lang('back').'';
include_once("footer.php");
[gelöscht durch Administrator]
Re: Speed up your CMSMS site
Vin, your code is actually caching the modules. The index.php I posted, does not cache the modules.You can leave the caching for modules now
Some modules don't work properly if you cache their output. For example, the validation on FeedbackForm won't work if the module output is cached.
Edit:
I have just downloaded CMSMS v1.0.5. My modified index.php will work with the with 1.0.5 also.
Last edited by jatinder on Sat Apr 14, 2007 6:18 pm, edited 1 time in total.
Re: Speed up your CMSMS site
Apparently, it did some. I shouldn't have relied on that trick I had in the index.php, my fault. So it seems there's no possibility for the modules to be properly cached now.jatinder wrote:Vin, your code is actually caching the modules.You can leave the caching for modules now
It would be nice to have the proper caching for the modules as well. Currently looking at the moduleinterface.php and classes.
Good to hearjatinder wrote: I have just downloaded CMSMS v1.0.5. My modified index.php will work with the with 1.0.5 also.

Last edited by Vin on Sat Apr 14, 2007 9:06 pm, edited 1 time in total.
Re: Speed up your CMSMS site
I've recently found out that the menus are updated only if you do something in Content » Pages - e.g. deactivating/activating the page (in Content » Pages, the list of pages; not the page editing itself).Vin wrote: However, adding new content/menu items is not a problem.
Re: Speed up your CMSMS site
Hi Vin,
on my sites I am using my own routine for the navigation. This means that individual pages will be addressed by their alias not by their ID (e.g. : index.php?page=home). This results in a wrong md5 encryption of $page in index.php for writing or reading the cache. Furthermore the cache could not be deleted after editing, because the page in the admin section is addressed by ID.
I do not know if others do address pages by the alias too, but if so, I would suggest to turn line 199 in index.php from
$mcv = './tmp/cache/thind_' . md5($page) . '.inc.php';
to
$mcv = './tmp/cache/thind_' . md5($pageinfo->content_id) . '.inc.php';
Greetings
on my sites I am using my own routine for the navigation. This means that individual pages will be addressed by their alias not by their ID (e.g. : index.php?page=home). This results in a wrong md5 encryption of $page in index.php for writing or reading the cache. Furthermore the cache could not be deleted after editing, because the page in the admin section is addressed by ID.
I do not know if others do address pages by the alias too, but if so, I would suggest to turn line 199 in index.php from
$mcv = './tmp/cache/thind_' . md5($page) . '.inc.php';
to
$mcv = './tmp/cache/thind_' . md5($pageinfo->content_id) . '.inc.php';
Greetings