It’s probably no secret that half of the IT blogs out there are running on WordPress or a similar Platform. WordPress is easy to use, simple, and requires little maintenance to run – what’s not to love?!
As with any Website – it doesn’t matter how good the back-end code or server hosting the site is, if your user is half way around the globe from where your site is hosted, the experience may not be that great… and not great experiences do not make for happy visitors. In the case of business/shopping websites this can mean international customers getting a bad experience for example, which is less than ideal if you are looking to grow and provide the same great service to users around the globe.
To combat this issue, a Content Delivery Network (CDN) is a great solution. A CDN essentially spreads your data across geographically separate servers across the world, and ensures that user requests are dealt with by the server that is closest to the end user. It is worth noting this means closest in networking distance, which is not always the same as physical distance. Azure has a great CDN offering with Points of Presence spread all over the world: https://docs.microsoft.com/en-us/azure/cdn/cdn-pop-locations – you would need to be in a VERY remote location to not have an almost local POP.
I’m going to test out WordPress running on Azure App Service natively, and then setup Azure CDN and compare the two – making use of Performance tests within Azure App Service to highlight the difference in metrics for both arrangements (Without CDN, and with CDN).
To start, I have deployed WordPress on Azure App Service with MySQL In App using the below template:
Head over to https://github.com/Azure/azure-quickstart-templates/tree/master/wordpress-app-service-mysql-inapp for the template.
Once this was deployed I completed the usual WordPress setup, and I now have a functioning site – but without any content. To create some content for testing, I used a plugin designed to generate posts and pages (with images) to give the site some content (including images) we can use when testing response times:
Once installed and run, this plugin gave me lots of posts and pages, to simulate the content of a real site, and all of these posts included an image:
Now I can start seeing how the site performs – without a CDN in place. Initially, I’m using a Performance Test to measure site performance – which can be accessed from the App Service pane in the Portal:
Creating a test is simple, I am just going to simulate 1000 users accessing in a 1 minute window:
As you can see, the metrics are coming back from the West EU test as follows with no CDN:
Average response time is probably the most key metric here – so 2.89 secs average from the West EU test region. To give an idea of the variation, I ran the test again, but this time from the East Asia region:
As you can see, there is a noticeable speed difference, albeit one that is to be expected. Based on the metrics (2.89s average West EU vs 5.81 average East Asia), we can see that the average response time for clients in the East Asia Region is around 200% that of those in the West EU region. So… about twice the waiting time for the page to load.
Configuring the Azure CDN
Configuring a CDN Endpoint for Azure Web Apps is extremely simple – it can be done from the Web App section of the Azure Portal:
For this test I have configured the CDN Endpoint as below. I’m using the Standard Akamai Offering for my test:
Once we have filled in the details the Endpoint is created:
Once the endpoint is created, we are presented with a new URL to access the CDN version of the site:
I then configured WordPress to integrate with the CDN using the CDN Enabler plugin:
To check the function – if we now have a look at the properties of an image on the page, we can see it is being sourced from the Azure CDN, and thus from a location geographically close to our users:
Because the plugin includes any content in wp-content, any image we upload to the Website will be provided to users via the CDN. Next up, I re-ran the performance tests to measure the performance differences now that we have switched some content to the CDN:
Based on the above test results, when implementing the CDN endpoint, we saw the following differences in test results in terms of average speed increases:
|without CDN||with CDN||% speed increase|
There are a few key results from this test:
- Utilizing the CDN improved performance in both the local and remote regions – in both cases significantly
- Remote regions saw the greatest performance boost at a 67% average load time speed increase
- The performance in the remote (East Asia) region was better than the original test of the West EU region after we had added the CDN endpoint
- Once configured both in Azure and in the Application (WordPress) there is no further configuration required
- We can further improve the speed by taking more elements of the Web Application and bringing them into the CDN – for example theme files, static code, CSS etc. In my test I have only included the wp-content directory but there is more that could be added.
Hope this has been useful… until next time!