There are many ways to improve the performance of a Web site and the strategies that optimize this performance can be organized into three types.
The first category concerns support hardware. It is obvious that improving the performance of the machine (physical or virtual) that is hosting the web site or an application can also significantly reduce the loading time of web pages. However, only large companies with direct access to the front-end machines, whether they’re placed in-house or at a colocation hosting provider, can hope to optimize the website performance by working on the support hardware. Small and medium size companies usually rely on a web hosting provider, so it is not always possible for them to choose the hardware that is right for them. They can, however, improve upon the technical features of their web hosting plan: number of processors, server RAM, bandwidth, etc.
The second category concerns the optimization of the server side scripting. Most Web applications use some sort of programming language to create dynamic web pages, with some examples being PHP, ASP, JSP etc. Once you choose the programming paradigm, the speed of the site will depend heavily on the quality of the software. Two websites using the same scripting language and a web host with same technical characteristics can significantly differ in their performance due to the architectural choices of the software. Put simply, with regard to the optimization of server side scripting, there are two factors that matter most:
- Choice of the platform.
- Skills of the development team that produces the software.
The third category concerns the material displayed on the front end like pictures, animations, content, and even the client side scripting languages.
Let’s see an example: Consider a Web page that weights 5KB on the server, written in PHP. If the code is well written, page could produce the markup sent to the client in a matter of milliseconds. If poorly written, it could take seconds to accomplish the same task .
Now, out of the three categories mentioned above, which one can you handle most effectively? The answer most likely, is the third one; simply because:
- As discussed earlier, most of us don’t have full control over the hardware,
- And server side programming, while very crucial, is also not under full control of the person who initiates activity on the Web. For example, if we use a CMS to create a web site, then we do not hold cards on the table and cannot expect to change website performance considerably. We can only use the most recent versions of CMS and hope that they are faster than the previous ones.
Reducing Website Loading Speed by Content Optimization
All modern browsers are equipped with tools that allow you to measure the loading time of each element on the page. For example, if you use Firefox, you can install the plugin Firebug. If you use Internet Explorer, you have an analysis tool built into the browser called ‘development tools’. If you use Chrome, you have an integrated tool which you can activate by this path: Customize menu – Tools – Tools for Developers. When you open a page on our site with one of these tools of analysis, you can get very useful information on the performance of the page.Let’s consider performance analysis using Firefox’s plugin Firebug.
In the figure above you can see the detailed information about each component- its size in KB, load time in milliseconds etc. Now you can identify the heavier elements and ask yourselves if you really want to keep them on the page. If they are extremely essential, are there any alternative solutions? (see for example the use of the CDN, discussed below)
Reducing Website Loading Speed by using Content Delivery Network (CDN)
When we load jQuery on our website we can specify a script tag to point to the jQuery site, such as in the lib directory. This means that every time a new user comes to the site, he will have to download the library, thereby hogging bandwidth and employing a certain time. However, if the script tag was referring to the URL of a CDN, then the library would be offloaded from the host associated with that URL. And CDN services consist of a network of servers that offer the same content. This means that the user will download the library using the bandwidth of the closest available server to his geographic location, thereby significantly reducing the page load time.
Most of the companies use CDN as a personal service to distribute their content on the Web. The primary advantage of this is that even if a company has its dedicated server located in India, even those who connect from UK will be able to load its website quickly, because it will automatically download all the content from the nearest CDN server.
Reducing Website Loading Speed by Optimizing the Size Of The Images
The most used formats of images on the web are probably JPEG, GIF and PNG. Depending on the type of image you can optimize performance by choosing the right size. To understand what is the best format for a certain image, we have to analyze the type of image.
- If the image contains many colors, spread in a phased manner, with detailed nuances (such as a photograph), you can decrease its size by saving it in JPEG format.
- If the image is simpler, i.e. made up of bars, charts, graphs or symbols with a few well-defined colors and no gradients, then should use PNG format.
In case of doubt you can do a simple test: save the image in both formats and compare the size, keeping an eye on the quality of the result. If the quality remains almost unchanged to the naked eye, but the size is greatly reduced, probably you should use the lightweight format, i.e. JPEG. If the dimensions are similar, or if the quality of the compressed format is insufficient, then you should choose the richer format (PNG or GIF).
In the next part of this article, I’ll discuss in detail about optimizing content published on the front end.
Was this guide helpful? Have I missed something? Please share in the comments section below.