Wordpress-on-Azure

WordPress on Microsoft Azure – Web App Vs Virtual Machine

Introduction

WordPress is one of the most popular open source blogging platform (or CMS), and we have couple of options when it comes to deploying the WordPress in Microsoft Azure. The easiest and straight forward deployment option is to use the WordPress template from the Web Apps gallery. I have used the same when I moved sreesharp.com to Azure, but after couple of weeks I realized the catch, and this article explain why I switched to Virtual Machine based hosting.

 Deploy WordPress from Apps Gallery

WebAppCreate

When we create the WordPress app, we get an option to select an existing database or create a new MySQL database instance. I have created a new MySQL database, and in couple of minutes I could start writing my first blog entry. Everything went fine, and I became the happy user of WordPress on Azure.WebAppCreate2

Page load performance hit

In order to improve the page load performance, I enabled the caching using WP Super Cache plugin, and configured most of the recommended settings.WP_Cache_settings

Unfortunately after enabling the cache support, page load performance became worse. Then I upgraded the Azure web app service plan from basic to standard, and even increased the capacity (1 core to 2 core), but no luck. Problem was not related to the Azure Web App, instead it was related to the default MySQL database. When we create WordPress app, we are using the MySQL service provided by ClearDb and it is their Mercury plan with 20MB storage and 4 maximum connection with low performance. Yes, you read it correctly. When we activate multiple WordPress plugins, and when they do background tasks, we might easily hit the limits set by the ClearDb default plan. Even I had tough time in getting connection with MySQL Workbench to take the db back up.  In short, default WordPress app from Azure Web app gallery is not good for production sites.

Performance Improvement Options

I can think of the following options, so that we can really take the benefit of Azure cloud platform to WordPress application.

  1. Upgrade the ClearDB plan from Mercury. Remember the subscription cost is only for the MySQL database, and we still have to pay for the Azure Web App.ClearDBPlans
  2. Create a virtual machine to host MySQL, and connect from existing WordPress app.  More details can be located here (Windows VM) or here (Linux VM). Again, we need to pay the monthly subscription for both Azure Web app and VM.
  3. Create a virtual machine, and install WordPress (including MySQL).  More details can be located hereVMCreate

Apart from the DB performance, there are bunch of items we can do to improve WordPress performance on Azure. Checkout this blog as well to learn about other techniques.

Below links provide the plan subscription info, and you do your math before choosing the option.

Azure Web App (Web Site) pricing

Azure Virtual Machines Pricing

ClearDB on Azure pricing

Conclusion

I have selected option 3, and configured Ubuntu VM, and installed the LAMP stack, and WorPress. No more worries on MySQL connection limit and monthly credit card bill. I have configured the auto scale option, and alert rules as well to  monitor the virtual machine performance.  Now SreeSharp.com is on Azure VM, and hopefully I can get the best out of the Azure hosting now.

Leave a Reply