Home > Articles > Web Development

  • Print
  • + Share This
Like this article? We recommend

Quick Fixes

After you've identified your website's performance problems, a few configuration changes almost always can improve your visitor's experience significantly.

Expiration Dates

You should set explicit expiration dates on all static files (JavaScript libraries, CSS stylesheets, images, and static HTML pages) to prevent browsers from querying the status of these files after each restart. (Expirations of static files usually isn't checked within a single browser session unless the files have a very recent modification date.)

Apache 2.0 and later allows you to specify default expiration time based on file type. You also could use regular expressions to apply expiration time on groups of files, or modify the expiration time for a directory tree (even within the .htaccess file). IIS has a similar functionality, called content expiration; it can be configured for a website, a directory, or an individual file through the IIS manager. (The expiration settings are under the Headers tab.)

Compression

If your server has spare CPU capacity, you should enable HTTP compression, which can result in significant response time improvements for non-broadband users. Read the mod_deflate documentation if you're using Apache Server. IIS users will find the instructions in Microsoft's online documentation. (You need IIS 6.0 to enable HTTP compression.)

Move Stylesheets and JavaScript

The browser won't start rendering the web page until it has downloaded all the CSS stylesheets. Therefore, the CSS stylesheets should be the first components listed in your web page.

Processing of the web page is interrupted while the browser downloads a JavaScript file (since the JavaScript code might change the web page through the document.write function). Place all the JavaScript libraries at the very end of your web page, if at all possible, or at least ensure that they're easy to cache.

Other Changes

After fixing the obvious problems, you'll probably have to perform a few additional changes, such as these:

  • Reduce the number of web page components. If at all possible, merge JavaScript libraries and CSS stylesheets into a smaller number of files. Use CSS sprites to display small images.
  • Perform the page layout with DIV elements, not with tables. Internet Explorer won't display the content within the table until the table code is completely loaded; thus, pages using table layout will display only when they're finished loading, resulting in significant amount of white screen time.
  • Clean up your HTML code and use CSS as much as possible. (See my article "Seven Common CSS Mistakes and How to Avoid Them.")
  • + Share This
  • 🔖 Save To Your Account