Welcome, Guest. Please login or register.
Did you miss your activation email?
04 Jul 2009, 17:35

Login with username, password and session length
Home Chat Help Search Calendar Login Register
Pages: [1] 2
Print
Author Topic: Speed up your CMSMS site  (Read 11142 times)
0 Members and 1 Guest are viewing this topic.
jatinder
Forum Members
**

Karma: 3
Offline Offline

Posts: 17


WWW
« on: 12 Apr 2007, 14:19 »

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

[gelscht durch Administrator]
« Last Edit: 12 Apr 2007, 23:31 by jatinder » Logged

DarshWebSolutions.com - Website Designing, Database Driven Websites, Custom Scripts and more
PHPSense.com  - PHP tutorials and scripts
Vin
Power Poster
***

Karma: 2
Offline Offline

Posts: 270


« Reply #1 on: 12 Apr 2007, 15:19 »

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...
Logged
jatinder
Forum Members
**

Karma: 3
Offline Offline

Posts: 17


WWW
« Reply #2 on: 12 Apr 2007, 23:29 »

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?
Logged

DarshWebSolutions.com - Website Designing, Database Driven Websites, Custom Scripts and more
PHPSense.com  - PHP tutorials and scripts
Pierre M.
Support Team member
Support Guru
Power Poster
****

Karma: 33
Offline Offline

Posts: 3467

Location: Paris

Please keep it simple


« Reply #3 on: 13 Apr 2007, 09:28 »

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.php/topic,1678.msg37558.html#msg37558

v2.0 has it already, according to http://blog.cmsmadesimple.org/2007/02/08/20-needs-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.
Logged

-- Pierre, support team member. comodrateur du forum francophone.
Please read "how to submit installation/support requests" before posting. Don't send private messages to ask for support.
Want to contribute to CMSms ? Improve the wiki with your forum account.
Vin
Power Poster
***

Karma: 2
Offline Offline

Posts: 270


« Reply #4 on: 13 Apr 2007, 11:43 »

I can't find a way to implement pagination in News module. How you do it?
Look here: http://wiki.cmsmadesimple.org/index.php/User_Handbook/Admin_Panel/Content/News/User_Defined_Tags
and you may like pagination for backend: http://forum.cmsmadesimple.org/index.php/topic,11194.0.html

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?
It's just the permanent cache. The pagination of News doesn't work, and the content is not updated immediately (sigh).

I can't wait for v2.0 Smiley.
Logged
jatinder
Forum Members
**

Karma: 3
Offline Offline

Posts: 17


WWW
« Reply #5 on: 13 Apr 2007, 12:36 »

Quote
It's just the permanent cache. The pagination of News doesn't work, and the content is not updated immediately (sigh).

Oh yes, it does  Smiley. I have another hack for the admin section which deletes the cache file when a page is updated.

I will check with the pagination though. Thanks for the link.
Logged

DarshWebSolutions.com - Website Designing, Database Driven Websites, Custom Scripts and more
PHPSense.com  - PHP tutorials and scripts
Vin
Power Poster
***

Karma: 2
Offline Offline

Posts: 270


« Reply #6 on: 13 Apr 2007, 14:27 »

Oh yes, it does. I have another hack for the admin section which deletes the cache file when a page is updated.
That would be nice Smiley. (I've been thinking about checking the expiration date with the query to the database in index.php, but this is   far more better Smiley). And does it work even for modules? For instance, News are updated in its own admin.

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.
Logged
jatinder
Forum Members
**

Karma: 3
Offline Offline

Posts: 17


WWW
« Reply #7 on: 13 Apr 2007, 23:56 »

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.

[gelscht durch Administrator]
Logged

DarshWebSolutions.com - Website Designing, Database Driven Websites, Custom Scripts and more
PHPSense.com  - PHP tutorials and scripts
Vin
Power Poster
***

Karma: 2
Offline Offline

Posts: 270


« Reply #8 on: 14 Apr 2007, 03:19 »

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 Smiley(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.

[gelscht durch Administrator]
« Last Edit: 14 Apr 2007, 17:37 by Vin » Logged
macyogi
Peanut Gallery


Karma: 0
Offline Offline

Posts: 9


« Reply #9 on: 14 Apr 2007, 10:02 »

Great! Just a little modification/fix:

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:
--
echo '<p class="pageback"><a class="pageback" href="'.$themeObject->BackUrl().'">&#171; '.lang('back').'</a></p>';

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.
Logged
Vin
Power Poster
***

Karma: 2
Offline Offline

Posts: 270


« Reply #10 on: 14 Apr 2007, 12:31 »

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.
Quote
echo '<p class="pageback"><a class="pageback" href="'.$themeObject->BackUrl().'">&#171; '.lang('back').'</a></p>';

include_once("footer.php");
What do you mean?

[gelscht durch Administrator]
Logged
jatinder
Forum Members
**

Karma: 3
Offline Offline

Posts: 17


WWW
« Reply #11 on: 14 Apr 2007, 14:12 »

Quote
You can leave the caching for modules now

Vin, your code is actually caching the modules. The index.php I posted, does not cache the modules.

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 Edit: 14 Apr 2007, 14:18 by jatinder » Logged

DarshWebSolutions.com - Website Designing, Database Driven Websites, Custom Scripts and more
PHPSense.com  - PHP tutorials and scripts
Vin
Power Poster
***

Karma: 2
Offline Offline

Posts: 270


« Reply #12 on: 14 Apr 2007, 17:03 »

Quote
You can leave the caching for modules now

Vin, your code is actually caching the modules.
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.
It would be nice to have the proper caching for the modules as well. Currently looking at the moduleinterface.php and classes.
I have just downloaded CMSMS v1.0.5. My modified index.php will work with the with 1.0.5 also.
Good to hear Smiley.
« Last Edit: 14 Apr 2007, 17:06 by Vin » Logged
Vin
Power Poster
***

Karma: 2
Offline Offline

Posts: 270


« Reply #13 on: 14 Apr 2007, 17:42 »

However, adding new content/menu items is not a problem.
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).
Logged
macyogi
Peanut Gallery


Karma: 0
Offline Offline

Posts: 9


« Reply #14 on: 15 Apr 2007, 05:18 »

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
Logged
Pages: [1] 2
Print
Jump to: