Optimize Azure website performance
A couple of weeks ago I moved my blog to a new wordpress site hosted in Azure. The deployment of the WordPress website was very smooth but I was not happy about the performance 🙁 So I started my investigation on how I could optimize Azure website performance.
If your WordPress site is slow then check for these:
Do not deploy on Free or Shared service tiers
Free tier or shared are not sufficient for running a production site and hence you need to upgrade to Basic or Standard Tier. Check out the features supported for each tier and select the appropriate Tier, Azure Websites Pricing per tier.
Service Tiers
The Azure Websites service is available in Free, Shared, Basic and Standard editions. The Free tier allows you to host up to 10 Websites in a shared environment. Basic and Standard tiers run your web apps in private Virtual Machines which are dedicated to your apps. You can host multiple websites/domains in each Basic and Standard instance you deploy.
FREE | SHARED | BASIC | STANDARD | |
---|---|---|---|---|
Number of unique websites/apps | 10 | 100 | Unlimited | Unlimited |
Disk Space | 1 GB | 1 GB | 10 GB | 50 GB |
Maximum daily bandwidth | Up to 165 MB per day | Up to 165 MB per day | Unlimited | Unlimited |
Custom DNS domain support | — | |||
SSL certificate support | — | SSL pricing applies | SSL pricing applies | 5 SNI SSL and 1 IP SSL included at no cost |
Maximum VM instances | — | 1 shared instances | 3 dedicated VM instances | 10 dedicated VM instances |
Autoscale support | — | — | ||
Staged Publishing Slots | — | — | 1 slot per site | 5 slots per site |
Web sockets | 5 connections | 35 connections | 350 connections | Unlimited |
Automated Backups | — | — | — | |
Global Traffic Management | — | — | — | |
SLA | Not available | Not available | 99.95% | 99.95% |
Is your website unloading after a while?
By default, websites are unloaded if they are idle for some period of time. This lets the system conserve resources. In Basic or Standard mode, you can enable Always On to keep the site loaded all the time. If your site runs continuous web jobs, you should enable Always On, or the web jobs may not run reliably.
Make sure your website and database are running in the same Region
If your website is setup in say West US and your database is setup in say East US ; then this can impact performance of the website as both these components are in different datacenters and network latency for the database calls can add to your page load time. Make sure your website and database are in the same regions/data centers.
You can verify the location of your website on the dashboard page
and the location of the database you need to verify in the cleardb management webpage:
Are your using a Free ClearDB MySQL database?
The Free ClearDB MySQL database is not a production website.
Immediately after upgrading my ClearDB I noticed a huge performance gain!
Monitoring endpoints
Now that we have optimized the website performance let’s monitor the response time! Monitoirng endpoints feature, available in Standard mode, lets you monitor up to 2 endpoints from up to 3 geographic locations.
Endpoint monitoring configures web tests from geo-distributed locations that test response time and uptime of web URLs. The test performs an HTTP get operation on the web URL to determine the response time and uptime from each location. Each configured location runs a test every five minutes.
Uptime is monitored using HTTP response codes, and response time is measured in milliseconds. Uptime is considered 100% when the response time is less than 30 seconds and the HTTP status code is lower than 400. Uptime is 0% when the response time is greater than 30 seconds or the HTTP status code is greater than 400.
After you configure endpoint monitoring, you can drill down into the individual endpoints to view details response time and uptime status over the monitoring interval from each of the test locations. You can also set up an alert rule when the endpoint takes too long to respond, for example.
To configure endpoint monitoring:
- Open Websites. Click the name of the website you want to configure.
- Click the Configure tab.
- Go to the Monitoring section to enter your endpoint settings.
- Enter a name for the endpoint.
- Enter the URL for a part of your website that you want to monitor. For example, http://mscloud.be .
- Select one or more geographic locations from the list.
- Optionally, repeat the previous steps to create a second endpoint.
- Click Save. It may take some time for the web endpoint monitoring data to be available on the Dashboard and Monitor tabs.
Go to the monitoring tab and you will after a while see the first response time of 3 different locations for your website!
Conclusion
The free or share website instacnce together with the free MysqlDB are not a solution for production websites.
Kind regards,
Alexandre
Leave a comment