Search code examples
asp.netsql-serverazureazure-web-rolesazure-vm-role

Azure Cloud Services vs VMs for Existing Asp.Net website


I have seen variations of this question but couldn't find any that dealt with our particular scenario.

We have an existing aps.net website that links to a SQL Server database. The database has clr user-defined types, hence it can only be hosted in Azure VM since Cloud Services don't support said types.

We initially wanted to use a vm for the database and cloud service for the front-end, but then some issues arose:

  1. We use StateServer for storing State, but Azure doesn't support that. We would need to configure either Table storage, SQL Databases, or a Worker role dedicated to State management (a new worker role is an added cost). Table storage wouldn't be ideal due to performance. The other 2 options are preferable but they introduce cost or app-reconfiguration disadvantages.
  2. We use SimpleMembership for user management. We would need to migrate the membership tables from our vm instance sql server to Azure's SQL Databases. This is an inconvenience as we want to keep all our tables in the same database, and splitting up the 2 may require making some code changes.

We are looking for a quick solution to have this app live as soon as possible, and at manageable cost. We are desperately trying to avoid re-factoring our code just to accommodate hosting part of the app in Azure Cloud services.

Questions:

  • Should we just go the VM route for hosting everything?
  • Is there any cost benefit in leveraging a VM instance (for sql server) and a Cloud Service instance (for the front-end)?
  • It seems to me every added "background process" to a Cloud Service will require a new worker role. For example, if we wanted to enable smtp for email services, this would require a new role, and hence more cost. Is this correct?

Solution

  • To run SQL Server with CLR etc, you'll need to run SQL Server in a Virtual Machine.

    For the web tier, there are advantages to Cloud Services (web roles), as they are stateless - very easy to scale out/in without worrying about OS setup. And app setup is done through startup scripts upon bootup. If you can host your session content appropriately, the stateless model will be simpler to scale and maintain. However: If you have any type of complex installations to perform that take a while (or manual intervention), then a Virtual Machine may indeed be the better route, since you can build the VM out, and then create a master image from that VM. You'll still have OS and app maintenance issues to contend with, just as you would in an on-premises environment.

    Let me correct you on your 3rd bullet regarding background processes. A cloud service's web role (or worker role) instances are merely Windows Server VM's with some scaffolding code for startup and process monitoring. You don't need a separate role for each. Feel free to run your entire app on a single web role and scale out; you'll just be scaling at a very coarse-grain level.