Slow page load times can impact your target user audience and discourage them from visiting your website again. A lot of search engines consider page load times as well when ranking results and can impact the visibility of your website on their search engine results. If you are running your WordPress website on Azure Websites and want to optimize it to obtain fast page load time, then consider implementing these quick and easy steps mentioned below:
1. Web site and Database must be in the same data center
When running your WordPress site on Azure Websites, make sure your database and website are in the same data center. Network latency can increase the page load time for your site if the website needs to go around the world to make a call to the database. Keeping the site and database components in the same data center will reduce the network latency and improve the page load time for your website.
2. Do not use FREE MySQL database
If you are developing the site, you can use the Free MYSQL database that comes with WordPress install from the Websites Application Gallery. But this is not ideal for a production level site. The FREE database has:
- Max 20MB storage for Database
- Allows up to 4 connections ( max_connections)
- Low performance
We recommend to use to a database that can handle your estimated user traffic from the various other options supported by ClearDB as seen here. To learn how to provision a database using Clear DB from Azure Store, click here. If ClearDB database option does not meet your needs, you can always setup an Azure VM running MySQL and use that server for your database. To learn how to install MySQL on an Azure VM, click here.
3. Optimize your database
WordPress auto-saves everything but the disadvantage with this is that your database gets filled with a lot of post revisions, trackbacks, pingback, comments and trash items quickly which needs to be cleaned up manually on a regular basis. With the database plan you are using with your Website there will be limitation to the storage size allocated to your database and you may hit this limit as well if the database is not cleaned up regularly.
WP-Optimize is a great plugin which allows you to routinely clean up your database making the database more efficient and filled only with what needs to be kept. It saves you a lot of time without doing manual queries to optimize and clean up your database.
4. Compress Images
If your WordPress site heavy with images, then images can take up most of bandwidth for your site. A couple of things you can do in this case:
- Store all your media content in an Azure Storage Blob: Use Azure Storage Plugin which allows your website to store any new content to Azure storage instead of uploads directory of your WordPress site. If your site is media content heavy, it can significantly help to use an Azure CDN with the Azure Storage to reduce bandwidth.
- Compress the images:WP Smush.it is a great plugin that automatically compresses images as you upload them to the media library. There is no data loss during compression and you won’t see any difference in the quality of images. If you have thousands of images are saved in your media library, you can run them all through the plugin, compressing them to a manageable size.
5. Reduce HTTP requests
Every website make multiple dependent requests either to JS, CSS files or third party services or libraries. Putting all JavaScript into one JavaScript file and all CSS in one CSS file is considerably more efficient and reducing the dependent requests wherever possible can help. For CSS/JS scripts you can run a minify plugin like Better WordPress Minify which will combine all of your style sheets and JavaScript files into one hence reducing the number of requests that the browser needs to make. If your site uses third party libraries, it’s better to copy them locally them to make a call to the service that offers the library to reduce bandwidth.
6. Diagnose if your theme is slowing down your site
Some themes just like plugins can be poorly written and can slow down your site. Test if your theme is responsible for the long page load times. To do this revert to the default WordPress template
TwentyFourteen and check if the page load time is much better. If yes, then the Theme could be the culprit. To resolve this pick another theme. If there is no difference in the page load time after reverting the Theme to an older version, the try some of the tips listed in this blog.
7. Diagnose if any plugin is slowing down your site
Some plugins can be the culprit in slowing down your site especially if they are poorly written or configured. Use a plugin like P3 to understand how much all the plugins used by the application do impact your page load time in order to take necessary actions to speed up your site If there are unused plugins, this can add to you page load time as WordPress tries to load all the activated plugins. Clean up or remove all the plugins that are not being used. Used only the plugins that can improve your website and not drag out the performance of your site.
8. Turn off Pingbacks and Trackbacks if you don’t use it
WordPress uses Pingbacks and trackbacks methods to alert other blogs that your posts link to.
- A pingback is a type of comment that’s created when you link to another blog post where pingbacks are enabled.
- Trackbacks are a way to notify legacy blog systems that you’ve linked to them.
They can be a drain the page speed and are usually better turned off if you don’t really need them. To learn more about Pingbacks and Trackbacks, click here.
9. Specify Image dimension
Before the content is displayed to the end user, the browser had to identify the layout of the content around the images. Not knowing the size of the images, the browser has more work to do figure this out and take longer. It a best practice to specify image dimensions which saves the browser from having to go through this step, speeding things up.
10. Caching
If you start seeing a surge of user traffic hitting your site, you should consider adding some form of caching for your site to handle the spike of traffic. You can use IIS output caching or WP-SuperCache plugin where both methods will cache static files.
- IIS output caching :It’s easy to configure and setup. It significantly improves site throughput but may prevent confirmation messages from showing up when submitting comments. To learn more about IIS output caching, click here.
- WP Super cache :It significantly improves site throughput and correctly handles comments submissions and other visitors’ actions. It slightly more complex to setup and configure than compared to IIS output caching. To learn more about Super cache configuration on IIS click here.
All these optimizations are just a few minutes of work and help you see drastic improvement in the performance of your website.