Hi All,
I made a few changes a couple of days ago to an installation of SS i had, as i was trying to work out why the live site was running slowly. This is a problem that a few of you have had (looking at the archived forum) so i thought it would be worthwhile pointing out what i have done / found, that might help!
First off, i'll explain my scenario, so that you can see whether or not we are in the similar boat! I installed SS on my gridservice hosting with mediatemple, and the gridservice is in effect shared hosting on steroids! However, there are enough similarities to call it shared hosting. I found that my site would take 10 + seconds to load, and it was nothing but frustrating.
I checking Google (as you may have done) for an answer but all to no avail. I then peered inside a configuration file for Silverstripe, thinking that i may be able to find something that could be switched off, to make things a little quicker.
I looking the mysite folder, in the root of the SS installation, and then opened the _config.php file. Within that file, i removed the items listing in the set_dev_servers, and this has made a huge difference to the performance. From what i've read on the dev notes page (http://doc.silverstripe.com/doku.php?id=devmode) it appears that by removing the items from that array, it stops errors from being emitted onto the browser, and instead emails them to you. In other words, it doesn't :
- check the ip address of the machine on each page load
- check whether error reporting is turned on
- pre-load files required for error reporting
Now, although it might appear trivial, i think a lot of people would leave the "set_dev_servers" as default, and therefore slow everything down.
Since i've made this change, my site now loads within a second, and appears a lot less sluggish.
Another thing i have found is the debug mode that can be switched on, on a page-per-page basis. To see an example, visit a page on your silverstripe site, and add the following to the address:
?debug_profile=1
This will report any errors that are found whilst loading the site / page, and obviously, by fixing the errors, you should increase your site speed.
If you don't receive any errors, you'll see how long each element of the site has taken to load, and how many times items were requested (calls).
Now, if you notice that your template is receiving a number of calls, then it could be that the complexity of your template is slowing things down a little. Without knowing how you are setup, i can't say "Do this and it'll work" but i would suggest you look closely at the output, and work with it to optimise your site.
Another thing, not related to SS per-say is the number of individual images that are used in your design. If you are able to combine some of your images into one large image, and then position the background image in css using the absolute values, such as:
background: url(test.png) 10px 40px;
this will also definitely help. Why? Well if you have a navigation for example that uses a glossy button feel, with a different background image for the hover effect, you are telling the browser to download 2 separate images, which slows down the process of loading the site in the web browser (for the client). By using sprites (the process of placing images on a larger "canvas") means that only one file is downloaded, and it'll speed up the loading of the site.
As a side note, it also stops any annoying flicker from occuring when you hover over, and it tried to load the image :-)
Well, i hope this helps a few of you out there! If you need a hand at all, please let me know! email gareth [at] codepotato [dot] co [dot] uk