none
Windows Azure Roles vs Compute Instances

    Question

  • Dear All,

    I am a student and I got an MSDN Premium Subscribers Azure account as part of a program for students. So what I have for free is 750h/month of a Small compute instance. Currently my teammates and I are building one of our university projects using Azure so that we utilize the new technologies. I went thru a lot of posts here but I didn't get the following: is it possible to run a Web role and a Worker role(s) on the same compute instance. In our project we have build 1 Web and 2 Worker roles and I am curious if I can host them all in the free instance I have.

    Thanks in advance.

    Cheers,

    Vassil

    Monday, November 29, 2010 9:10 PM

Answers

  • Is it possible to run a Web role and a Worker role(s) on the same compute instance

    No. Each role runs with one or more instances. Each instance gets its own VM. These VMs are not shared between instance. In your project you would need a minimum of three instances. Every hour your service is running you will be billed three instance hours (assuming you are using small instances) against the 750 hour allocation. The 750 hours is sufficient to keep a single instance running 24*7 for a month. Consequently, I suggest that you delete the deployments when you are done testing them to avoid exceeding your 750 hour allowance.

    You may also want to look at combining your worker roles into a single worker role. If you are not creating two roles with different scalability characteristics there is probably not much point in splitting the functionality across two different roles.

    • Marked as answer by Vassil_ Tuesday, November 30, 2010 12:03 AM
    Monday, November 29, 2010 9:52 PM
    Answerer
  • Hello Vassil,

    You are missunderstanding the concept of Roles, Instances, Cloud Service. Let me try to explain these terms.

    First, when you login to the Azure management portal (http://windows.azure.com/) you have a project and you can create a new "Hosted Service". That is your uniquely named Cloud Service. Cloud Service is also the Project Template within Visual Studio.

    A single Cloud Service can host multiple Cloud Roles. Currently available Cloud Roles are: Web Role (ASP.NET), Worker Role, CGI Web Role(FastCGI), WCF Web Role, ASP.NET MVC 2 Web Role. Just be aware that currently a Cloud Service can have just one unique input endpoint per Role! So if you opt for multuple Web Roles in your Cloud Service, each of them must run on different port (i.e. 80, 8080, 8081, 81).

    Now for the instances. For each role, you define the number of instances that will run. A role instance is a single deployment of your role to a dedicated virtual machine. All role instances are automatically put behind a hardware load-balancers.

    But be aware - each instance you create consumes compute hours! Compute hours are even consumed when you have deployed your cloud service project, but have stopped it! So be careful and only deploy running app. If something fails and you need to upgrade, make sure you delete the deployment as soon as possible.

    A quick calculation will show you that a Single Instance of a Role, running 24/7 consumes about 740 hours a month, which is quite close to what is offered by MSDN premium!

    I hope this answers your question!

    Monday, November 29, 2010 9:59 PM

All replies

  • Is it possible to run a Web role and a Worker role(s) on the same compute instance

    No. Each role runs with one or more instances. Each instance gets its own VM. These VMs are not shared between instance. In your project you would need a minimum of three instances. Every hour your service is running you will be billed three instance hours (assuming you are using small instances) against the 750 hour allocation. The 750 hours is sufficient to keep a single instance running 24*7 for a month. Consequently, I suggest that you delete the deployments when you are done testing them to avoid exceeding your 750 hour allowance.

    You may also want to look at combining your worker roles into a single worker role. If you are not creating two roles with different scalability characteristics there is probably not much point in splitting the functionality across two different roles.

    • Marked as answer by Vassil_ Tuesday, November 30, 2010 12:03 AM
    Monday, November 29, 2010 9:52 PM
    Answerer
  • Hello Vassil,

    You are missunderstanding the concept of Roles, Instances, Cloud Service. Let me try to explain these terms.

    First, when you login to the Azure management portal (http://windows.azure.com/) you have a project and you can create a new "Hosted Service". That is your uniquely named Cloud Service. Cloud Service is also the Project Template within Visual Studio.

    A single Cloud Service can host multiple Cloud Roles. Currently available Cloud Roles are: Web Role (ASP.NET), Worker Role, CGI Web Role(FastCGI), WCF Web Role, ASP.NET MVC 2 Web Role. Just be aware that currently a Cloud Service can have just one unique input endpoint per Role! So if you opt for multuple Web Roles in your Cloud Service, each of them must run on different port (i.e. 80, 8080, 8081, 81).

    Now for the instances. For each role, you define the number of instances that will run. A role instance is a single deployment of your role to a dedicated virtual machine. All role instances are automatically put behind a hardware load-balancers.

    But be aware - each instance you create consumes compute hours! Compute hours are even consumed when you have deployed your cloud service project, but have stopped it! So be careful and only deploy running app. If something fails and you need to upgrade, make sure you delete the deployment as soon as possible.

    A quick calculation will show you that a Single Instance of a Role, running 24/7 consumes about 740 hours a month, which is quite close to what is offered by MSDN premium!

    I hope this answers your question!

    Monday, November 29, 2010 9:59 PM
  • Thanks a lot for the clarification, Neil. I think that we'll definitely combine the 2 worker roles into 1.

    I have just one more question: what about using 2 Extra Small instances instead of 1 Small? The price for running an Extra Small is more than twice less per hour than the price for a Small instance. Is such a conversion possible ?

    Monday, November 29, 2010 10:01 PM
  • Extra Small instances are not yet available. But when it comes, you surely can use 2 extra smalls, instead of 1 small. And yes, you will get cheaper prise for that.
    Monday, November 29, 2010 10:07 PM
  • Vassil -

    You would certainly be able to use Extra Small instances when they become available. Indeed, experimentation like yours is one of the principal use cases for this role type.

    Monday, November 29, 2010 10:36 PM
    Answerer
  • Thanks for your reply Anton :)

    I see that things weren't exactly the way I thought they are. The immediate workaround that I thought of is putting the libraries that were supposed to run as a Worker role as Web Services (WCF or ASMX) together with the website in a single Web Role and invoking the services manually from time to time. (since the tasks to be performed in the background are neither time-critical nor that heavily computational) Do you think that this is a viable solution to my 1 instance limitation or I should look for an account that has 2 instances?

    Monday, November 29, 2010 10:47 PM
  • there's also been no clarification on if an extra-small instance will use less of the MSDN provided 750hrs or not.

    And you should be able to start up a background process during the role's OnStart event and put your worker processing in that thread. :)

    Tuesday, November 30, 2010 12:04 AM
    Moderator
  • The following is documented in the Windows Azure Platform Offer Comparison Table:

    3 - Extra small compute instances will begin availability in beta this calendar year and will be billed separately from other compute instance sizes. The monthly compute hours included in this offer cannot be used towards extra small instances.

    I didn't see similar wording on the MSDN offers.

    Tuesday, November 30, 2010 12:17 AM
    Answerer