Multiple roles on the same instance in Windows Azure

Yaplex picture Yaplex · Feb 18, 2012 · Viewed 9k times · Source

Is it possible to deploy multiple roles in the same instance?

I have three web roles (website in asp.net mvc3, and two WCF services instances) and two worker roles (windows services).

The load for this application is very small, so I don't want to create so many instances in Windows Azure and pay for all of the instances now. Instead I want to deploy all my application in the same instance and change it later if I will get some income from my applications.

I Googled and found some forum posts than it's possible and some than it's not possible... but I can't find information how to do it...

So two questions: Is it possible? How can I do it?

Answer

David Makogon picture David Makogon · Feb 18, 2012

A slightly different answer than @Simon's... A Role is actually a template for a Windows Server 2008 VM (see my answer on this SO question as well). Each role has one or more instances, and you can run whatever you want on any role.

You can absolutely run your website and all your WCF services in a single role. You'll now scale your application up/down (VM size) and out/in (# of instances) as a single scale unit. If, say, your WCF services are CPU-intensive, causing the VM instances to slow down for your web visitors, you'll need to scale out enough to handle those visitors.

Once you reach a significant traffic load, it's worth considering separate roles. That way, you can decide on VM size and quantity per role. Maybe you have 2 or 3 Small instances of a Web role to handle your user traffic on the website, and maybe 2 Medium instances of a Worker role to handle WCF services (just as an example). The more roles you have, the finer-grain scaling you have, but you must run at least one instance of each role, which elevates your "system at rest" baseline cost.