Loading
Cancel
Webmail Login
Control Panel Login
Server Requests : An easy to understand guide
.CO.UK ONLY £5.33
Find your perfect domain here

Server Requests : An easy to understand guide

Server Requests explained

Supercharge your site : Server Requests explained in real terms!

In this series of blog posts, we will be looking at how to get that extra bit of speed out of your website. If your site is running slow then you need to start looking at what is causing the speed issues. Over the next few posts, we will go into detail on what could be causing any speed issues and how to fix them.

This guide will explain what server requests are and how they can drastically affect your site's speed. Instead of going into technical detail which let's be honest (unless you are a web designer or server admin) is hard to understand. We will be comparing server requests to equivalents in the real world.

Ok, strap on your seatbelt and let's supercharge!

What is a server request?

Your website is built up in many parts, you will have the coding of the website (HTML, PHP), the design files (CSS) which tell the website how to look and finally a database where various settings are stored.

Every time your website loads, it will look for all these files to display them to the user. For each file, your website needs to make a request to the server the file is stored on, asking it for a copy to give to the person viewing your website.

Confused? Ok, let's say you go to your local greengrocers and ask for a bag of 12 apples and 2 oranges. The Manager asks a staff member to bring a bag to the table then he asks him to run off to bring back an apple. When he gets back, he asks him again to run off and get another apple. He repeats this procedure until he has 12 apples in the bag. He then repeats this procedure for 2 oranges until he has all the fruit needed and the bag is full. You can see the bag being filled but only when he has filled the bag does the manager put it in your basket to take away.

Server Request

This is the same principle used when loading up a website. Before you can view the website (bag), all the files (apples/oranges) need to be collected (server requests) from the greengrocers (server) and placed in your basket (computer browser) to view/use.

Of course, this happens very quickly and usually you will see your website load in a few seconds but if you walked into your local greengrocers and they did this, would you think it was efficient?

How does this affect speed?

Every time your site makes a server request (more apples please), the website has to wait until it gets the file it wants before it can show it to the user. If you have a lot of server requests, your site has to wait until most of them are completed before it can load up the site. The more requests your site has to make, the longer you will need to wait for the bag to get filled.

External File Requests

When you buy hosting, you have your own server space (your own little greengrocers). Every time a customer comes in, you can collect the apples and provide them with a bag full. But what happens when someone asks for an orange (file) which is not in your greengrocers (server)? What if the orange they want is half way around the word in another supermarket? Now, you have a problem. Your shopkeeper has to run all the way and fetch this apple and bring it back.

External Reference

This is the same principle as when you request a file from another server. An example of this is if you are using a theme on your website that uses files such as fonts stored on another server.

But wait, what if the server the file is on is overloaded/busy and there is a queue? Your poor shopkeeper has to wait in line leaving the customer stood waiting for their bag of apples/oranges. Only when the shopkeeper comes back, can the customer have their bag and if that queue's long, your website is going to slow down.

external resources wait

It's all well and good having nice fast hosting but if you ask for files that aren't on your server, you're at the mercy of the external server's speed. Not only that but even if the external server is fast, the customer still has that extra wait whilst the shopkeeper fetches the items.

Lowering / Combining Requests

Let's say you have followed the steps below and optimised your site to only use files on your server. How else can you speed up the site?

Websites are often made up of HTML, CSS, javascript files and images. If your customer wants the bag of fruit and there are 12 apples (CSS files) and 2 oranges (javascript files) in each bag, instead of the shopkeeper running back and forth, why not put all these apples in 1 bag and all the oranges in 1 bag before the customer comes into your shop? Suddenly you have cut the amount of trips the shopkeeper needs to make to provide a basket of fruit down from 14 to 2.

This is the same with websites, many files can actually be combined into one larger file reducing the amount of server requests and in turn, reducing load time.

How to fix your site

So you now know what server requests are and you're ready to supercharge your site. First let's start with a quick and easy speed increase.

Remove external requests

As we have mentioned above, external requests can seriously lower a website's speed. If you connect to a server that is slow, your website will follow suit. To combat this, you need to find which files you are using on your site that are not on your server.

A quick and easy way to do this is to run your site through Pingdom.

Pingdom

Simply visit http://tools.pingdom.com/fpt, enter your website address in the box then click 'test now'.

You will now see a waterfall of files appear. Each one of these files is what your website is using to load and each one equals one request. You can also see the website address the file is located on. Often you can see how a website is being held up waiting for an external file, the file may load quickly but the initial request and the wait can still slow down a site.

What you will need to do is locate all the files that are not on your website address and save them to your hosting. Next, update your website's code to use the file on your server instead of the external one. There are some exceptions to this and some which you won't be able to copy accross (e.g. some facebook references if you have a like button on your site) but as a rule of thumb, try to get all the files on your own server.

Lowering the amount of requests.

The next step is to try and lower the amount of requests. This can be done by combining files. The most common method is to combine all your CSS files into to one single CSS file and all your .js files into one single .js file. This is usually a case of simply copying and pasting them all together. Some CMS (content management systems) such as wordpress have plugins that can do this for you automatically.

If you do this manually, make sure to remove the references to the old CSS files from your code otherwise you will still be making requests for them.

Server Request Summary

In short, try to keep your requests to the least amount possible and use files on your own hosting. Do this and it's almost certain, you will see a speed increase.

In our next guide we will cover how to lower the size of the requests by optimising your site.



Leave a comment

Has this guide helped you? Have an idea for a guide or need help? Let us know below.

© Copyright 2014 | Squirrel Hosting Limited
Company Number 9031308