Tag Archives: web sites

An Azure Web Site is a VM which supports multiple applications

This will be unnecessary for Azure experts, but I have seen some misunderstanding on this point, hence this post.

A “web site” is a unit of service on the Azure cloud platform which represents a web application hosted on IIS, Microsoft’s web server (but see below). You write a standard ASP.NET application and deploy it. Azure takes care of configuring the host VM, the server operating system, and IIS.

Using a web site is preferable to creating your own VM and installing IIS on it, for several reasons. One is that you do not have to worry about patching and maintaining the operating system. Another is that web sites can be scaled, manually or automatically, with an option for scheduling so that you can scale down the site for periods of low demand.

image

The main reason for using a VM rather than a web site is if the app has dependencies that fall outside what a web site can handle.

Another thing to know about Azure web sites is that they have four “plan modes,” but only two are worth considering for production. The Free and Shared modes host your application on a shared VM, and quotas are applied. If Azure decides your site is out of quota, it will stop responding. Fine for a prototype, but not something you want customers or users to see. This feature is not shown clearly on the table of features but it is in note 2:

Shared Instance: Free and Shared (Preview) tiers include 60 minutes and 240 minutes of CPU capacity per day, respectively. The Shared (Preview) Website rates are applied per website instance.

The Basic tier on the other hand is decent. It is a dedicated VM, and you can scale it (manually) to 3 instances. It costs around 25% less than a Standard tier site.

Why go Standard? You get 50B storage thrown in (a Basic tier site has 10GB), auto-backup, auto-scale up to 10 instances, and a fixed IP address for SSL. If you have to buy a fixed IP address for a single instance Basic tier site, the price goes above a Standard tier site, except for a Large instance.

Currently a Basic tier web site costs from £35.64 to £141.92 per month, and a Standard tier from £47.10 to £189.65, depending on the size of the VM.

It is a significant cost, but what may not be obvious is that you can deploy multiple applications to a single web site, which makes my statement above, “A ‘web site’ is a unit of service on the Azure cloud platform which represents a web application hosted on IIS”, not quite correct.

When you create a new web site, if you have one already, you can choose a “web hosting plan”. Here is an example:

image

In this case, there are two pre-existing web site VMs, one in East Asia and one in Europe. If you choose one of these two, the new web site will be added to that VM. If you choose “Create new web hosting plan”, you will create a new dedicated instance (or free, or Shared). Adding to an existing VM means no extra cost.

If you are a developer, it may well be better to run a single Basic VM for prototyping, and add multiple sites, rather than risking a free or shared instance which might be out of quota when you demonstrate it to your customer.

What is the limit to the number of web sites you can add? There is none, other than the overloading the VM and getting unresponsive applications.

Postscript: the Web Site service is interesting as an example which blurs the boundaries between IaaS (Infrastructure as a service) and PaaS (Platform as a service). It is more PaaS than IaaS, in that you do not have to worry about maintaining the OS, but more IaaS than PaaS, in that you are still having to think about individual VMs. It would be more purist if Microsoft abstracted away the VMs and simply guaranteed a certain level of service, or scaled up automatically and billed for what you use. On the other hand, the Web Site concept puts a lot of control in the hands of the developer/admin and help them to make best use of the resources, while still removing most of the maintenance burden. I think it is a good compromise.

A closer look at Azure web sites: beware suspension

I am investigating moving this site to Windows Azure. The major benefit would be scalability. Currently it runs on a Linux VM which works very well, but in the event of a major spike in traffic (which is always possible with a news/comment site) it cannot scale.

Windows Azure web sites have nice scalability features. You can add and remove instances, or set up autoscaling based on a schedule or by CPU usage.

Unfortunately this does not come cheap. For autoscaling, you need a Standard web site, which starts at around £35 per month (1 core, 1.75GB RAM) for a Small instance, if you buy a 6 month plan.

Backtracking a little, Azure offers three levels of web site:

  • Free: Shared hosting, 1GB storage, 165MB per day outbound transfer
  • Shared: Shared hosting, 1GB storage, 5GB per day outbound transfer, up to 6 instances. In preview but currently around £7.00 per month per instance
  • Standard: Dedicated hosting, starts at £48 per month pay as you go, £35 per month 6 month plan.

For a quick test, I set up Brandoo WordPress from the Azure app gallery. Brandoo WordPress uses SQL Server rather than MySQL. MySQL on Azure is only available from a third party, ClearDB, which puts me off using it, unless you go a different route and use your own Windows or Linux VM to run it, losing the scalability benefit.

I started with a free web site. I have used free web sites in the past to prototype .NET applications, for which purpose they are excellent. The experience with WordPress was not so good. The site seemed to hang during the WordPress install wizard. My second go was successful, but the site was slow even just navigating the dashboard. Hopeless for any serious use beyond prototyping.

I converted the site to Shared hosting. The price is modest, and I wondered if the ability to scale manually up to 6 instances when needed might be sufficient. The performance improved markedly, compared to the free version. However I noticed these odd metrics in the dashboard: CPU time and Memory Usage, with notes like “Resets in 5 hours” or “Resets in 33 minutes”.

image

In particular, I noted that I had used nearly half of my allocated “Memory usage” just installing an empty WordPress site.

I am not familiar with measuring memory usage per hour and I am not even sure what it means. However, it seems that the consequences of exceeding either the CPU or the memory limit is extreme. The web site is suspended. See for example here:

Something strange happened today. My website on windowsAzure was suspended and inaccessible because my site had exceeded the CPU quotum. I am running the website in shared mode, but I had removed all quota. So why is my website suspended, I thought I would pay for the extra usage, not that my website would be suspended. What is happening here? And what should I do to prevent this from happening again?

See also Jonas Gauffin’s post Azure Failed Me (which has a more positive conclusion than you might expect from the title):

Today I were going to search my blog (http://blog.gauffin.org) about how to do a (almost) a generic type constraint for enums. But instead I got this screen: This site is currently not available. The scary thing is that I’ve got no notification what so ever about my site being down. So I browsed to the manage web site part of Azure and was greeted by the following screen: Suspended. As you see the CPU time has been consumed.

The same problem, I am guessing, hit this user, who has a tutorial on setting up a WordPress blog to Azure, but says at the end not to use it:

Also, even after perfect configuration of the website, Windows Azure was still showing some problems like this “This site is currently not available…” what a joke, the site is in cloud – global cloud – and not available, so when will?

though he apparently did not identify the reason.

It does not seem to me unreasonable that the free option suspends your site; it is free after all. The shared site is low-budget, but still paid for, and it seems to me that the problem of suspension should be spelt out more clearly. If you read:

A web site running in Shared mode benefits from high availability even with a single instance, but you can add up to 6 instances ("scale out") for even greater performance and fault tolerance.

you do not expect that the site will simply stop responding for up to a day if it exceeds CPU or memory limits that are often not easy to predict.

There are thousands of hosting services offering shared hosting or WordPress blogs at low prices, not least WordPress.com, and in general these sites do not get suspended because of exceeding CPU or memory limits.

The conclusion though is that if you want to use Azure for a site whose uptime you care about, you should plan to use no less than a Standard instance.