21294 Posts in 5734 Topics by 2602 members
|Go to End|
18 January 2009 at 8:01am
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:
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
18 January 2009 at 10:23am
Actually, as you are using MediaTemple GS, it's likely that you are experiencing slowdown from the fact that your site is served by many different machines - each with a unique tmp folder. This means that SS needs to rebuild the manifest and other things on every page request from a unique machine - which would take a huge performance hit on every load.
The way to fix this is to create a silverstripe-cache folder in your website root - SS will cache it's files there, and this cache will be shared among all the machines (along with your site files) so it will not need to be completely regenerated each request.
18 January 2009 at 10:27am
That could affect a few people, but i had already created the manual silverstripe cache folder from when i was problem solving something else before
I have similar slow-downs on my dedicated server, and after making the changes i listed below, i've noticed an increase in speed on the live site. Don't know if its anything else, as i haven't played with any other bits of code. Just thought my findings might help some people out there
18 January 2009 at 1:28pm
That certainly is odd - removing the set_dev_servers() call does not make SS load any fewer error reporters or anything - and it shouldn't make more than a few milliseconds of difference at the most. I suspect that something else may have come into play with your installation.
Also, I'm wondering what you mean by the complexity of your template? If you mean lots of includes, this has no performance impact except for when the templates are re-generated as it is all combined into one file.
14 September 2010 at 7:10am
I am not sure if this was supposed to work, but I had 3 very slow SS web Sites and not very complicated ones at that. I commented out the dev servers as suggested and wow the speed difference was instantaneous.
It sure worked for me. Now I don't need to worry about switching just yet.
16 September 2010 at 8:51pm
I can confirm the same here on a quite extensive website. Speed improvement is specially remarkable in the CMS. No benchmarks though, maybe later if asked to.
16 September 2010 at 8:53pm
Odd, isn't it. But at least my method was able to help.
Maybe the developers could look into what could potentially make this slow. I wish i had time to look through it, but i'm too busy at the moment!
18 September 2010 at 3:13am Last edited: 18 September 2010 3:13am
I added the following, I think I'm following your suggestion - but see no major increase. could you please confirm this is what you meant?
I'm in the final stages of development, was hoping to go full-on cached with static publisher when I was done.
// set site to live mode
// log errors and warnings
SS_Log::add_writer(new SS_LogFileWriter('/..../logs/ss_errors.log.php'), SS_Log::WARN, '<=');
|Go to Top|