I have built my site using coldbox version 3, and have published it
live on the web..
However, the site runs very slowly, and every once in a while the site
will load so slowly that I recieve an error "The request has exceeded
the allowable time limit Tag: cfdirectory".
This may be because i am on a shared server, but wondered if I was
doing anything wrong with my code which may be causing it..
I have the site here http://www.forevr-dev.co.uk/musicexplained/, and
have left the debug options visible so you can see whats happening
behind the scenes..I know the debug options slow things down but am
leaving them on here so you can get a better picture, the site is slow
even with the debug options disabled..
Think it maybe running bit faster now, but early days...is there
anything else that affect performance....the site is running off a
shared server..could this be an issue?
Yeah, am gonna give it a go..
Its just that on my live server...without the debugging, i was having
really bad performance issues...http://www.music-explained.com/
Think that may have improved now following sanas suggestions
I just hit the live server and it really is slow. If you hit http://www.music-explained.com/Application.cfm you'll get an error
page immediately. That says it's not anything in the infrastructure -
it's either something in ColdFusion's configuration (Report Execution
Times could be the culprit - but no hosting company should ever have
that enabled!) or in your code that may be causing performance
problems on the production server (for example, accessing the DB or
some HTTP resource).
The problem could also be what was actually specified in the
error...cfdirectory taking too long. What are you doing with
cfdirectory in this operation?
FWIW, I’m seeing timeouts on cfoutput, not cfdirectory. I get those fairly frequently when the app launches the first time. However, I typically don’t have another problem for the duration of the application lifecycle.
Do you not experience this slowness when your run it locally? Are you connecting to the same database in development as production?
Yes, that's expected. My point was that responds very quickly but the
real site does not, hence my deduction that it isn't an inherent
infrastructure problem.
Now, its strange if the site is working quick here, but slowly on my
live server, as its the same files and folders etc....The only issue i
can think of is that on my staging site the coldbox install folder is
under the wwwroot, and then my site is in its own folder under the
root...So
WWWROOT
---------- COLDBOX
----------- MUSICEXPLAINED
---------CONFIG
---------- HANDLERS
---------- MODEL
WWWROOT
-------- COLDBOX
---------CONFIG
-------- HANDLERS
-------- MODEL
Would this be a reason for the difference in performance? If not it
may be something to do with the components that im loading into my
application scope on applicationStart
Your index page took about 14 seconds to load, and Debug rendering took 6 of those seconds.
You should really turn off the CB debugging. It can output a LOT of HTML depending on how much stuff you have floating around in your request collection. I can't even turn it on in my app or my browser starts puking on all the HTML.
You need to do some performance testing on a staging server (that you actually have control over) that is as close to your production server as you can get (this includes CF settings and CB settings). MAKE SURE you turn on all the CB caching settings. (EventCaching, HandlerCaching, IOCObjectCaching, ConfigAutoReload, ModelsObjectCaching etc )
Then install SeeFusion or something similar on your staging server and actually look at your query execution times and stack traces. Your app doesn't have to be a black box, you just need the right tools to look inside.
Lastly, a lot of the browser load time for me was all the page assets. It took my browser 31 seconds to download all the parts of your page. You have 20 JavaScript and css files totalling almost half a meg which have to be requested from the server separately. Look into a minimizer/combiner for those.
You also have 40 image files totalling 3.6 Megs! Your overal page with assets is over 4 Megs of downloading. You need to start lazy-loading some of those revolving images and/or reducing their sizes. A 300x300 png probably doesn't need to be 482 KB.