Optimizing Coldfusion website performance
Following this great presentation by Peter Farrell in Coldfusion Meetup, I made a bulleted list of tips to optimize site performance. I encourage you to watch recorded session, since Peter gave so much valuable information.
User experience with the website depends among other factors on reaction responce time.
Not only human, but also Google gives better marks to faster websites.
In 3 times out of 4, faster response is gained by client-side optimization. Here are tips to make your website react faster to user actions.
- avoid IFRAMEs - browser spawns browser instance inside it;
- keep element count and element nesting low, as complex DOM will bring browser performance down;
- keep number of HTTP requests as low as possible;
- load single "sprite image" and some CSS, instead of dozens of small images;
- since browser allows only 2 parallel requests to one domain, use separate domains for different type of content
(dynamic scripts on one and static (images, scripts, css) on other);
- avoid HTTP redirects, use URL rewrite instead of redirects;
- avoid 404 errors;
- since favicon is always requested, have it on your site, otherwise 404 error for this request is unevitable;
- avoid excessive DNS lookups (despite fact browser caches DNS lookups);
- use PNG images;
- use less cookies, as they transmitted with every request and often client's upstream connection is much slower than downstream;
- use CDN or file hosting (Amazon for example) for static content;
- cache AJAX things (HTML pieces, JSON objects);
- make use of idle time, preload things in background while user is reading page;
- put new content to webserver early, preloading in current version of site.
When new version of site will be rolled in, new content will be already cached by browser;
- I think these are great and easy tips to use.