Speeding up CMSMS

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
taufikp
Forum Members
Forum Members
Posts: 27
Joined: Tue May 01, 2007 2:52 am

Speeding up CMSMS

Post by taufikp »

Here's what I do for my site (it's not accessible to public right now):
  • Open index.php
  • Scroll down until you see the header("Content-Type") line
  • Below that line add this: header("Content-Length: ".strlen($html));
  • Then add this line: header("Cache-Control: public, max-age=60, s-maxage=60");
For more info about those lines read Caching Tutorial for webmasters and web authors: http://www.mnot.net/cache_docs/
Pierre M.

Re: Speeding up CMSMS

Post by Pierre M. »

Hello,

Thank you.
I'm pretty sure this is what Apache's mod_cache is doing without touching CMSms' code.
But not all hosting providers provide mod_cache which they should love.

Pierre M.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Speeding up CMSMS

Post by calguy1000 »

Though the content length mod should be harmless, the caching header should only be done if the page is marked as cachable..  dynamic pages (like those with content from FEU or CustomContent, etc), should not cache.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
faglork

Re: Speeding up CMSMS

Post by faglork »

Hi!

Depending on the nature of your site, you might cache various elements via .htaccess file.

Here's what I use:

Code: Select all

ExpiresActive on
ExpiresByType image/gif "access plus 6 months"
ExpiresByType image/jpeg "access plus 6 months"
ExpiresByType image/png "access plus 6 months"
ExpiresByType text/css "access plus 6 months"
ExpiresByType text/javascript "access plus 6 months"
ExpiresByType text/html "access plus 1 day"
ExpiresByType application/x-javascript "access plus 6 months"

<Files ~ "\.(js|css|gif|jpg|png)$">
Header append Cache-Control "public"
</Files>
This is from a site which barely changes.

hth,
Alex
cyberman

Re: Speeding up CMSMS

Post by cyberman »

Hi Alex,

thanks for that (for me unknown) hints - will adding this to tuning guide :).
faglork

Re: Speeding up CMSMS

Post by faglork »

Hi Andreas,

don't forget to add this link:
http://www.ircache.net/cgi-bin/cacheability.py

With this "cacheability engine"  you can check how the elements of your page are cached - nice for nailing down specific cache conditions.

Additionally I can recommend the "live http headers" extension for Firefox:
http://addons.mozilla.org/firefox/addon/3829

And as taufkip already mentioned, you have to understand
http://www.mnot.net/cache_docs/
first or you'll get in trouble.


Cheers,
Alex
Last edited by faglork on Thu Aug 16, 2007 3:04 pm, edited 1 time in total.
Pierre M.

Re: Speeding up CMSMS

Post by Pierre M. »

Thank you Alex.
Andreas, where is the tuning guide ?
Have fun

Pierre M.
cyberman

Re: Speeding up CMSMS

Post by cyberman »

Pierre M. wrote: Andreas, where is the tuning guide ?
It's currently only available in german

http://forum.cmsmadesimple.org/index.ph ... 474.0.html

But maybe Google can help ;)

http://translate.google.com/translate?u ... de&ie=UTF8

(for french users only)

Hope you can understand it ...
Last edited by cyberman on Fri Aug 17, 2007 1:28 pm, edited 1 time in total.
cyberman

Re: Speeding up CMSMS

Post by cyberman »

OK, and here the link for all english speaking users

http://translate.google.com/translate?u ... uage_tools

(made this topic sticky)
cyberman

Re: Speeding up CMSMS

Post by cyberman »

faglork wrote: Depending on the nature of your site, you might cache various elements via .htaccess file.
Hmm, have tried it from a vserver, but got only a 500 error from server :-\ ...

What's wrong?
Pierre M.

Re: Speeding up CMSMS

Post by Pierre M. »

What is in the logs ?

Pierre M.
faglork

Re: Speeding up CMSMS

Post by faglork »

cyberman wrote:
What's wrong?
Do you have mod_expires installed?

Alex
cyberman

Re: Speeding up CMSMS

Post by cyberman »

Thx Alex (and Pierre).

I see I must have tomatos on my eyes - mod_expires was not installed (I've afraid it) 8).
cyberman

Re: Speeding up CMSMS

Post by cyberman »

faglork wrote: And as taufkip already mentioned, you have to understand
http://www.mnot.net/cache_docs/
Great document - I see, I have a lot to translate ;) ...
Pierre M.

Re: Speeding up CMSMS

Post by Pierre M. »

cyberman wrote:
faglork wrote: And as taufkip already mentioned, you have to understand
http://www.mnot.net/cache_docs/
Great document - I see, I have a lot to translate ;) ...
Yes, great. I like very much what is said about URLs, configs... And even already translated in French and Czech :)
Please notice : this march version is focused on browser side cache tuning (via mod_expires and mod_headers). May be the next will add mod_cache about webserver cache tuning in front of a "dynamic" content like CMSms (and obviously all expires and headers recommandations remain efficient).

Pierre M.
Post Reply

Return to “Tips and Tricks”