Servage Magazine

Information about YOUR hosting company – where we give you a clear picture of what we think and do!

Speed up your website – Part 1: Content

Sunday, July 1st, 2018 by Servage

There are many ways to improve website performance. The “Yahoo best practices for speeding up your web site” is a very comprehensive guide to optimizing many factors of your website. However, the article is very long, and sometimes quite hard to understand, because the technical level of the article is high. Therefore I have collected the main tips of the optimization guide, and will present them in a series of more comprehensible articles.

Make fewer requests

Each page often contains multiple resources, which each generate a request. For example a basic HTML page with a CSS stylesheet and 5 images, generates a total of 7 request (one for the HTML, one for the CSS, and one for each of the five images). There are two major ways of reducing request: Combine all your stylesheets into one .css file. Combine all your JavaScripts into one .js file. Merge your images into a single sprite file, where possible (a sprite file is a single image that contains all your icons etc., and uses them with CSS background-positioning).

Reduce number of DNS lookups

Before every request your browser identifies the IP for the given hostname (domain). If possible, increase the time to live (TTL) value for your DNS entries. Also avoid using more than a single hostname in your request. I.e. don’t include a CSS file from abc.mydomain.com when the page is served as www.myotherdomain.com.

Avoid redirects

Phase put solutions where you redirect unnecessarily. There is no need to force for example http://domain.com/articles/ when the user just entered http://domain.com articles (without the trailing slash).

Cache AJAX responses

This is a bit more advanced, and should be taken straight from the Yahoo guide.

Postload components

Include the necessary items in the initial code, and load other stuff afterwards. F.eks. large files like images could be loaded after the rest of the page using YUI Image Loader.

Preload components

Where possible, try to preload content you anticipate is going to be used later. Thereby you use the browsers idle time to load further data, and make the next page appear faster for the user.

Reduce number of DOM elements

More code means more data to be transmitted and processed by the browser. Large amounts of DOM elements (basically HTML tags) in your website could be avoided by improving the markup of your page. Try to keep your HTML code simple, and stick to the HTML convention.

Split components across domains

In contradiction to the previous tips regarding the usage of DNS lookups, there can be circumstances where using multiple domains has an advantage. Check out this article for more in-depth information.

Minimize amount of iFrames

iFrames are good to include content from external sources, at the expense of extra requests. So consider the necessity for iFrame usage. If you serve content from your own domain with iFrames, you should definitely try to implement it directly into the page. Each iFrame triggers a whole series of requests, depending on their content (HTML page, CSS files, JS files etc.).

Avoid 404 errors

Each request consumes resources. Using them on errors (file not found) is a waste. The user will most likely continue submitting requests, trying to find the intended content. Avoiding 404’s is therefore a neat way to avoid unnecessary requests.

If hope you find these tips useful. I will continue with explaining more tips from the Yahoo guide soon.

Speed up your website - Part 1: Content, 4.0 out of 5 based on 10 ratings
Categories: Guides & Tutorials, Tips & Tricks

Keywords:

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

No comments yet (leave a comment)

You are welcome to initiate a conversation about this blog entry.

Leave a comment

You must be logged in to post a comment.