create new tag
, view all tags

set expiry and ETags to improve your TWiki performance

2007-09-27 - 12:37:33 by SvenDowideit in General
TWiki uses alot of static files, and util we implement the magic js and css minify we've been talking about for a while, you can reduce the load on your apache server, and increase the aparent speed of your user's experience, by setting the Expires HTTP header for static files to 'quite large'.

Because TWiki.org has an obvious cyclic usage profile TWiki view mrtg graph, and because we're likely to upgrade the server to 4.2.0 in the comming months, I've settled on = ExpiresDefault "access plus 11 days"=.

you may need to turn on the mod_expires module in your apache's httpd.conf, but the rest of the settings can be put into the .htaccess file in the pub directory.

#this prevents clients from re-requesting at all, freeing up apache to serve what what we need
#LoadModule expires_module libexec/httpd/mod_expires.so
#AddModule mod_expires.c
<ifmodule mod_expires.c>
  <filesmatch "\.(jpg|gif|png|css|js)$">
       ExpiresActive on
       ExpiresDefault "access plus 11 days"

#add ETags.
FileETag MTime Size

What these settings mean, is that browsers that have requested and received static files, in this case images, css and javascript any time in the last 11 days, will not even ask the server if those files have changed. thus often reducing the number of requests for a view to just the html output from TWiki.

If you want to see th other things you can do - see YSlow for Firebug and extension for Firefox that is almost compulsory for developing, or administrating web servers smile

other links:

(Not sure if 11 days is a good idea for .js files - could be a long time to wait to pick up changes in an AJAX file, but a good idea for images and CSS I think.

BTW the blog comment plugin on this page is broken at least for me - generated a page containing only my comment, though I now realise that's probably the idea - it's just rather different to most other blog comment setups. Also on hitting the back button I got something like ViewAfterSaveCachesOldPage, which at least is an on-topic bug but was also confusing. Also, I can't see how to edit a blog comment after posting.) - RD


RichardDonkin - 29 Sep 2007:

Good idea to go for the static content first! There are some links about cache control headers at BrowserAndProxyCacheControl, though that was mostly thinking about TWiki's dynamic content.


Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2007-09-29 - RichardDonkin

Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Help
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.