Speed of loading is extremely important for any website. It is observed that visitors tend to visit other links in the Google Search results, If your website does not load within seconds. We had the experience of loosing about 40% of the visitors, when our website ran slow for about 10 %.
When it comes to WordPress, many factors come into picture which affect the blog / website load speed. These things may not matter for the websites that serve static pages. All WordPress sites pages are rendered dynamically, loading the content from database.
Some important factors are
– Hosting Server, their uptime.
– PHP version.
– How powerful is the server in terms of resources.
– Availability of features like, sub domains, gzip compression.
– Speed of executing SQL queries.
We faced problems in the past of loosing visitors when the speed was not optimal. We did struggle a lot to find the suitable tutorials which address this issue, finally made little bit of research by ourselves and decided to put this as a post so that it could help many people who face this issue.
Why my WordPress blog is running slow?
Starting from server side, many things can influence the speed of your WordPress site. Some of the most important points to be noted here are.
– Plugins : Do not install too many plugins, install only those plugins which are crucial for your website to run.
– Missing DB Optimization: optimize the database by using wp optimize plugin, download here.
– Themes : Make sure that , the images, style sheets related your theme load fast. Install only those themes which have got good rating and user reviews.
– Database overheads : Wordpress stores lot of un necessary information in the database. for example, comment metadata. Delete such entries from Database, if you do not really need it. You can do it from your hosting control panel or from any suitable plugin. We would recommend to do this in control panel, taking the backup of your database first.
How to know where is it going wrong?
When our website was running slow, we broke our head to figure out, where exactly the time is consumed for loading your site. Thanks to GoDaddy, they gave one awesome plug in to analyse in detail, the execution of wordpress scripts.
This plug in is called P3 Plugin Profiler.
Once you install the plug in , you can start analyzing the installed WordPress core files and the plugins. Once the scan is complete, you will see the initial view of results.
If you want to see, which WordPress plug in is consuming more time, You can view the pie chart .
Detailed timeline view looks like this.
Via this tool, you can clearly see which plug in consumes more time, and in exactly which MySQL query.
This plug in helps you to decide on which plug in needs to be un installed.
General Tips to improve speed of WordPress
– Sub Domains : Always load the images from a sub domain. If you see in mytechyard, we load images from a sub domain. Storing images in sub domain allows browser to make parallel requests with the server , along with the requests of WordPress core files which are stored in root directory.
– Cache: Caching is crucial in WordPress. We use W3 Total Cache, Which enables, database , disk and object cache methods. Also W3TC enables gzip compression for HTML pages.
– Image Size: Keep image files minimum in size, also do not overload pages with too many number of images.
– Theme images : load theme images also from sub domain, if you have created one.
– Reduce PHP calls: Many of the general information such as footer note etc can be directly written in the footer.php file, without having to call a PHP function to load the same from database. These replacements for PHP calls should be done carefully, and wherever possible.
If you take care all the above steps, Your website or WordPress blog loads significantly faster !