So far in the WordPress on the Cloud series, we successfully installed WordPress and understood what are the major differences while working with a cloud server instead of VPS. We also learned how to manage themes, plugins and deployment for WordPress sites on Cloud. If you have followed the tutorials so far, you should have WordPress site running with smooth & fast deployments. Now it’s time that we take a deeper look at site performance optimization. We need to make sure that our WordPress site is fast, which is very essential when you are trying to deliver the best user experience and SEO (Search Engines take site speed into consideration while ranking).
For achieving the said optimization, we will make use of general optimization methods like caching, CDN, asset compression, database optimization, etc; Once basic optimization is in place, we’ll fine tune it by using monitoring tools and making appropriate changes accordingly.
For basic optimization, we will be using W3 Total Cache, CloudFlare, query cache & optimization, etc; so let’s discuss these methods one-by-one. Note that during this tutorial we will be following the same “Develop Locally, Deploy Globally” strategy we learned and adopted in a previous tutorial.
Content Delivery Network (CDN)
CDN is a network of distributed servers dedicated to serve content with reduced page load time, higher availability, and scalability. Many of the big companies have already adopted this technology as it turns out to be reliable, cost efficient and scalable option. To use CDN for our WordPress site, we can use plugins like W3 Total Cache or Cloudflare. They both are quite easy to set up and they work together quite well. To use these plugins, first install & test the plugins in a development environment (i.e. the local machine in my case) and then deploy the changes.
Web Caching is a widely-used method for temporarily storing and serving static content. Having a cache system in place helps in achieving drastic positive difference in the site performance. Note that CDN and Cache are not exactly the same systems. In fact, one can use them together for advance site performance optimization. To use a Cache system in our WordPress site, we can use the W3 Total Cache plugin by activating corresponding options within the plugin. W3 Total Cache comes with one more important feature which minimizes content and files. This feature helps us in reducing files size and number of files, which results in minimizing number of transaction; thus effectively improving both site performance and user experience.
The stats above are obtained from phpadmin installed in production along with the database. I am using MySQL database obtained from ComputeNext Global Cloud Marketplace, rest of the details about the database can be found here.
As the content of the WordPress sites increases, performance of the site is affected due to increased data query time. Database indexing is most commonly used method for improving query performance. Although WordPress database is already indexed, there is scope for query optimization to improve overall performance of the site. You can take a look at detailed description of WordPress database here. One more method for database optimization is query cache; enabling query cache in the WordPress sites will cache frequently used SQL queries. This method will increase the memory consumption but this increase is quite insignificant and can be neglected considering the overall performance improvement, thus validating its use.
Monitoring and Fine Tuning
So far we have performed basic optimization techniques on our WordPress site. To take this optimization to the next level we need to fine tune the current configuration, to do so we take help of monitoring tools like New Relic. By looking at results we get from monitoring, we proceed towards customized optimization.
New Relic is powerful performance monitoring tool we will be using for making sure that the WordPress configuration is optimized to our needs. With New relic provides detailed graphical performance report about server, transaction, disk, errors, events, third party requests, database performance, themes and plugin, etc. With this information in hand, one can make sound decision on where to make further changes to keep the site running smoothly. New Relic integrates nicely with W3 Total Cache, providing us with more options to choose from the pool of performance optimization tools. There are some WordPress New Relic (unofficial) plugins available, make sure to take a look at them.
Note that you can use W3 Total Cache, CloudFlare, New Relic together even if they have some common features, you just have to make sure to enable/disable corresponding option while configuring the tools. For this series I have chosen combination of CloudFlare (content delivery network and security), W3 Total Cache ( to minify assets, database & object cache), New Relic (monitoring).
This concludes third article in WordPress on Cloud series. Stay tuned as we move towards fourth and final article of the series, where we will test optimization techniques we discussed in this article. We will also take a look at some advanced WordPress configuration and some other resources for WordPress on Cloud.