Speed the most affecting factor in context of Internet, every user hates the wait time for anything. SEO brings the traffic to your website, but the retaining percentage of those users is directly proportional to load time of the website.
Following are quite easy and effective optimization techniques to speed up your web-site:
Caching – The key to optimization.
Caching is most effective technique to speed up your website. The idea is to store the files on local storage, so that the request to server is minimized and hence the load time decreases significantly.
Generally there are two types of caching –
Leverage Browser Caching– In this the files are stored on the client’s browser itself and when the page is loaded instead of requesting server the files are loaded from the local storage.
This is achieved by adding expiration headers in HTACCESS file for example:
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/ico A2592000
ExpiresByType text/css A2592000
Server side Caching– In this a cached copy of the page is stored at the server. All the database queries are stored at server side and no dynamic content is loaded. (this practice is followed generally on static websites.). It is also termed as page caching.
The images constitutes the major share of page size and hence should be optimized as much as possible.
Serve scaled image – The original dimensions of image should be same as of HTML and it should not be resized on the browser.
Use image sprites – Small images should be combined into a single image and should be managed using CSS, in this way we also reduce the HTTP request.
Optimize images – The images should be optimized so as to reduce image size as small as possible. Several optimizing tools are available online such as www.jpeg-optimizer.com
Also try to divide JS into two parts, one required while page load, and other containing functions needed after page download.
Enable GZIP compression
By this server sends zipped file to the server hence less response time. This can be achieved by inserting following code in HTACCESS
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
There is no use of white spaces or indentation in context of server.
So minifying the JS and CSS reduces its size and execution time.
The overall idea is to Minimize HTTP requests the number of request sent to server directly affects the load time.
There are online tools where you can check the loading time of your site, and see all the requests sent to server.
Eg: www.gtmetrix.com, yslow, tools.pingdom.com etc