Ask a Jedi: Is my site slow because of Ajax or something else?
Paul asks:
I've been working on a project using Mach-II and Spry, which can be viewed at here. I'm using a Spry master-detail layout on each pages. All of the content is stored in xml files. So, I have Spry datasource configured for each page also.
I'm wondering if the slow page loading is related to Mach-II or Spry. The site is running on a shared hosted server (viux.com). If it's related to Spry, then could some of the problem be resolved by pre-loading the data sources somehow. If so, how would that be done with Mach-II.
I see you've delved into Spry, just not sure how far, or whether my question even makes sense. Anyway, let me know if you can help. I've trawled through Google and not getting many answers. Other people have complained about the slow loading on the Adobe website, but no answer was furnished to that particular point.
Perhaps if you browse my website as shown above, you can see what I mean. The page initially loads real slow, but after its loaded, it's fine. But customers will be gone before that happens.
When it comes to answering "Why is my page slow", there are a number of things you need to look at. A typical request to a ColdFusion site normally involves these items:
- User request URL X.
- CF works on creating the response to X.
- CF returns a response (just a stream of text) to the browser.
- The browser renders the response. This may involve more HTTP requests for CSS, images, and Ajax items.
So which of the above is the slow portion of your site? It seems like the response from the server is a bit slow. Since you are using Mach-II, one of the first things I'd check into is to see if the framework is reloading. If Mach-II is like Model-Glue, there is a setting that determines if the entire framework should reload on every request. This can really slow down the response and you are recommended to turn this off in production. I'd bet Mach-II is the same, and I'd check there first.
My gut here says the issue isn't Ajax. Using Firebug (you are using Firebug, right?) I see that your XML being returned is very little (3KB). Your Spry files look fat, so I'd be willing to bet you aren't using the minimized versions. I'd switch to that.
You also want to get the YSlow plugin to Firebug. As you can guess, it tries to tell you why your site is slow. Your grade was an F, but I'm not sure why. Most of the things it failed you on seemed minimal to me. Your C for JavaScript files doesn't surprise me.
How good is the connection to your site? It may just be the network between here and there. Since your site involves China goods, I'm guessing it may actually be in China. Is it? If so then you could always consider multiple servers based on the location of the requestor. (I've never done that myself.)
I'll let others chime in as well on things they may see in the request.
Comments
FAQ here:
http://greatbiztoolsllc-trac.cvsdude.com/mach-ii/w...
I'd stick with the auto reload mach-ii as mentioned above as your first stopping pt.
You should also enable gzip on your webserver just to give a little extra performance.
looks like you are running on windows. here is a link for how to enable that with IIS
http://www.microsoft.com/technet/prodtechnol/Windo...
Ajax is pretty lightweight, I have been using it without any problems for a while. Except for some real weird loadData issue that Im trying to figure out (another story :))
@Adrian: It could be.
2.) If it's CF 6.1 - 7, can they put SeeFusion monitoring on it to see what's going on?
3.) Do you have access to the DB such that you can put traces/profiling on it to see if the DB or SQL statements need tuning? (the usual suspects are poorly-written queries, poorly implemented table indexes, and queries that pull in much more data than they really need - too many columns or too many rows, or both)
If you can't figure out any way to get access to the info for 1-3 above, then I'm afraid you're probably just taking shots in the dark at what the problem *might* be.
http://www.websiteoptimization.com/services/analyz...
-------------------------------------------------
TOTAL_OBJECTS - The total number of objects on this page is 16 - consider reducing this to a more reasonable number. Combine, refine, and optimize your external objects. Replace graphic rollovers with CSS rollovers to speed display and minimize HTTP requests.
TOTAL_SIZE - The total size of this page is 208140 bytes, which will load in 44.68 seconds on a 56Kbps modem. Consider reducing total page size to less than 30K to achieve sub eight second response times on 56K connections. Pages over 100K exceed most attention thresholds at 56Kbps, even with feedback.
IMAGES_SIZE - The total size of your images is 114183 bytes, which is over 30K. Consider optimizing your images for size, combining them, and replacing graphic rollovers with CSS.
SCRIPT_SIZE - The total size of external your scripts is 79245 bytes, which is over 8K. Consider optimizing your scripts for size, combining them, and using compression where appropriate for any scripts placed in the HEAD of your documents.
-------------------------------------------------
I'm not worried about the image sizes. But, I'll need to attend to the others.
For a pretty simple page, I'm not sure how I end up with 16 objects on there.
I'm now on the packed versions of the spry js files. They are apparently still quite large, but at least better than before.
The site is faster at least once the framework is loaded and I'll keep tweaking it.
Should I get off XML and onto JSON?


CF Debugging being switched on on the server could kill it like this.