Wednesday, August 6, 2014

Azure WebSite, Cloud Service and Virtual Machine: which to choose?

Sometimes it happens to start a new development project or to plan a deploy on the cloud, on Azure, but you don't know what kind of service is better to use: a WebSite, a Cloud Service or a Virtual Machine? What pros and cons do they have?

Let's deiscover the main differences.

Warning: this post is updated with the information available to August 5th, 2014.

First of all, a diagram (the same that Microsoft uses in the Azure official docs), to compare our three services:

Courtesy of Microsoft

In this image the "simplicity / control" ratio between services is quite clear. To be extremely synthetic:

  • WebSite: 
    • Solution extremely simple to use, it offers a good set of tools to support (monitoring, alerts, stairs, etc) but at the expense of the level of customization and control over the configuration. 
    • In multi-tier applications, it provides support to the only web tier
  • Cloud Service:
    • Less simple to use and deploy compared to Websites, provides a much greater level of control.
    • Also in this case there are several tools for monitoring and support already included
    • You can use both WebRoles (that actually are dedicated VMs with IIS installed) as well as WorkerRoles (always dedicated VMs, but without IIS. You can think about WorkerRole as a Windows Service)
    • In multi-tier scenarios, you can use a combination of WebRole and WorkerRole to implement the web tier, the middle-tier and the backend
    • In multi-tier, you can scale the frontend and the backend independently
  • Virtual Machine:
    • Leaves the configuration and customization completely to the user, so it's more complicated to manage but provides the highest level of control possible, as with the on-premises server.
    • You can use it for any kind of application and architecture
    • You need to manually deal with the management of the system, including upgrades, security policies, etc. etc.
    • It's the ideal choice in complex scenarios or when you need to host software or services that are not supported in WebSites or Cloud Servives.

This is the official services features comparison table:

Access to services like Service Bus, Storage, SQL Database
Host web or web services tier of a multi-tier architecture
Host middle tier of a multi-tier architecture
Integrated MySQL-as-a-service support
Support for ASP.NET, classic ASP, Node.js, PHP, Python
Scale out to multiple instances without redeploy
Support for SSL
Visual Studio integration
Remote Debugging
Deploy code with TFS
Deploy code with GIT, FTP
Deploy code with Web Deploy
WebMatrix support
Near-instant deployment
Instances share content and configuration
Scale up to larger machines without redeploy
Multiple deployment environments (production and staging)
Network isolation with Azure Virtual Network
Support for Azure Traffic Manager
Remote desktop access to servers
Ability to define/execute start-up tasks
Automatic OS update management
Integrated Endpoint Monitoring
Seamless platform switching (32bit/64bit)
1 Web or worker roles can integrate MySQL-as-a-service through ClearDB's offerings, but not as part of the Management Portal workflow.
2 Although Virtual Machines can scale out to multiple instances, the services running on these machines must be written to handle this scale-out. An additional load balancer must be configured to route requests across the machines. Finally, an Affinity Group should be created for all machines participating in the same role to protect them from simultaneous restarts from maintenance or hardware failures.
3 For Web Sites, SSL for custom domain names is only supported for standard mode. For more information on using SSL with Web Sites, see Configuring an SSL certificate for an Azure Web Site.
4 Web Deploy is supported for cloud services when deploying to single-instance roles. However, production roles require multiple instances to meet the Azure SLA. Therefore, Web Deploy is not a suitable deployment mechanism for cloud services in production.

If you want to take a llok at the complete services comparison, see the guide on the official Azure documentation.

No comments: