Search code examples
azureinstallationasp.net-web-apiazure-web-roles

Running many items in an azure web role


At my current company we are doing some research into azure with the view to moving some of our older systems into the cloud. We have the following systems which are all installed at the customers location.

Database (SqlServer) Processing Server (Winform App) Various Clients (Winform Apps)

What we would like to do is to convert the processing server into an ASP.NET Web API and create a new Job Scheduler as some sort of long running process that would poll the database and send requests to the processing server.

This is all fine but we are unsure of the best method to do this.

We are happy to use a service for the job scheduler and ASP.NET Web API for the server but we don't know the best way to manage installation.

What we would like to do is have one WebRole with the scheduler and server per large customer and one WebRole with multiple schedulers and server running concurrently.

So to the question,

Is this actually possible? Can you run many items in a web role?


Solution

  • A Web Role is essentially a Windows Server virtual machine with some code scaffolding. You can run anything that can be installed via interaction-free MSI/xcopy/etc. You have startup scripts as well as the ability to install from code (in OnStart() event handling).

    Web Role and Worker Role differ primarily be the activation of IIS. Otherwise, you can treat them as equivalent.

    The nice thing about defining separate roles (whether web or worker): Each has its own size and quantity. This lets you, for instance, set up a bunch of Small web role instances for your front end, and maybe one or two Large instances to do some compute-intensive tasks. Really, though, nothing stops you from loading up everything into a single role. It's just that now everything will scale in lockstep.

    SQL Server doesn't fit well in the web/worker role model, as the install can't be completely automated. This fits better in a Virtual Machine (allowing you to build out the VM and save it, to be run at any time, fully built-out). More info on Virtual Machines here. If you go this route, you'll need to provide direct access to your database from your web role. You can use a Virtual Network for this.

    One last thing about SQL: Windows Azure SQL Database is database-as-a-service, where you don't build out anything: Just enable it, set your max size, and begin using it. While it doesn't have every single feature of SQL Server, it covers the vast majority of it, and scales to 150GB per database (and provides shards for scaling beyond that). You only pay for storage capacity with Windows Azure SQL; no cost for the servers that run it, and no need to maintain a database server.