Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Roles and Instances

Can I have a Web Role and a Worker role run on the same instance, or do I have to obtain 2 separate hosting instances and pay twice the amount I would otherwise?

I have a WCF Web API that I want to host on Azure. I also have a Worker Role that listens to a Queue in Azure Storage. Every time a message is added to the Queue, it will obtain that and run a small task depending on the message.

I was wondering if I can just run these two on the same instance or not.

like image 560
Anup Marwadi Avatar asked Feb 10 '12 23:02

Anup Marwadi


People also ask

What are Azure role instances?

Define role instance in Azure. A role instance is nothing but a virtual machine where the application code runs with the help of running role configurations. There can also be multiple instances of a role as per the definition in the cloud service configuration files.

What's the main difference between Azure roles and Azure AD roles?

Azure AD roles are used to manage access to Azure AD resources, whereas Azure roles are used to manage access to Azure resources. The scope of Azure AD roles is at the tenant level, whereas the scope of Azure roles can be specified at multiple levels including management group, subscription, resource group, resource.

What are roles in Windows Azure?

The three roles are important to understand in regard to Azure applications. You can see that the three key roles are the web role, the worker role,and the VM role. These roles are a key components of an Azure application.


1 Answers

"Worker Role" and "Web Role" are just simple templates for "Windows Server 2008 with IIS running" and "Windows Server 2008 without IIS running." The key is that a "role" is a definition of a Windows Server virtual machine. For each "role" you have one or more instances.

In Windows Azure, both role types have the ability to install software, modify registry settings, etc. in either a startup script or OnStart() handler, and both let you run code in the Run() method.

In your case, you can run your WCF Web Service in a Web Role, and then in your Run() method (in the same role), kick off a process that listens to queue messages posted by your WCF web services. No need to have a new role.

Now: Once you get into high-volume situations, you might want to split your code into separate roles, so you can scale them independently (both in VM size and VM quantity).

I posted another answer about this here.

like image 196
David Makogon Avatar answered Sep 22 '22 00:09

David Makogon