Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Increase site speed


Go to End


6 Posts   1628 Views

Avatar
lozhowlett

Community Member, 151 Posts

5 February 2013 at 7:30am

Hi Everyone

We have just launched www.safari.co.uk, and its working really nice - apart from the speed. We really need to improve page load times and optimise the image library.

Can anyone sign post me to ideas / guidelines. I think there is a lot of performance to be gained in the cache of cropped images that could be served as static image instead of having to pass through the GD library everytime (or is this already happening?).

Thanks in advance for any pointers!

Lawrence

Avatar
swaiba

Forum Moderator, 1899 Posts

6 February 2013 at 9:27am

Hi,

Looks like a brochureware site - so http://doc.silverstripe.org/framework/en/reference/staticpublisher - could be a huge win.

If you want to do a partial cache...
http://doc.silverstripe.org/framework/en/reference/templates#partial-caching
http://doc.silverstripe.org/framework/en/reference/templates#calling-templates-from-php-code

Then you have the more complicated server setup... APC, memcache, varnish (http://en.wikipedia.org/wiki/Varnish_(software)).

Lastly, of course is analysing your site with something like kcachegrind and improving the code you have added :)

Avatar
kinglozzer

Community Member, 187 Posts

7 February 2013 at 1:08am

Images don't get passed through the GD library every time, only when they are first resized. It then checks if a resized image exists and serves it if it does.

I agree with Swaiba - partial caching & static publishing help a lot, partial caching alone recently saved us about 30% on loading times.

Avatar
lozhowlett

Community Member, 151 Posts

7 February 2013 at 1:20am

Thanks for this. Also applied these htaccess rules which have helped a lot...


<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType text/html "access plus 7 day"
  ExpiresByType text/js "access plus 7 day"
  ExpiresByType image/gif "access plus 7 day"
  ExpiresByType image/png "access plus 7 day"
  ExpiresByType image/jpg "access plus 7 day"
  ExpiresByType image/jpeg "access plus 7 day"
  ExpiresByType image/ico "access plus 7 day"
  ExpiresByType text/css "access plus 7 day"
  ExpiresByType text/javascript "access plus 7 day"
  ExpiresByType application/x-javascript "access plus 7 day"
</IfModule>

<IfModule mod_deflate.c>
  SetOutputFilter DEFLATE
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  # Don't compress images, movies or zip files
  SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
  SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
  SetEnvIfNoCase Request_URI \.(?:avi|mov|mp3|mp4|rm|flv|swf|mp?g)$ no-gzip dont-vary
  <IfModule mod_headers.c>
    # properly handle requests coming from behind proxies
    Header append Vary User-Agent
  </IfModule>
</IfModule>

Will work on the partial cache soon, just need to work out what elements can be cached like that. Also setting up a varnish server as a test.

Thanks again

Avatar
Devlin

Community Member, 344 Posts

7 February 2013 at 4:50am

Edited: 07/02/2013 4:51am

html5boilerplate.com has a nice .htaccess file too.

Edit: https://github.com/h5bp/html5-boilerplate/blob/master/.htaccess

Avatar
Nobrainer Web

Community Member, 138 Posts

11 February 2013 at 11:14am

If you missed it, there is also a blog post about performance. I use that as guide for improving performance on sites:
http://www.silverstripe.org/how-to-improve-website-performance/

And then i use http://tools.pingdom.com/fpt/ to see where i should improve, and ofcourse also the showqueries=1 url param onsite.