How many roles can you have per Azure instance
Asked Answered
B

3

6

I know that you can only have 1 web role per instance but does this apply to Background roles as well? In more detail can 1 instance run a background role and a web role?

Benedict answered 27/8, 2010 at 8:48 Comment(0)
B
15

I think the terminology used in your question is confusing the other responders.

In Windows Azure compute, you have a cloud service. A cloud service can be thought of as your overall architecture, or at least the front end, the middle tier, etc (any tier where there is compute as opposed to storage). For example your application might have a presentation front end (ASP.Net MVC web application) and a middle tier (WCF service layer over basic http). We liken each of these tiers to "roles". So in my example above, I would have 2 web roles in my cloud service. I might also have some back end processing which does some sort of batch work, this would be a "role" also. Roles that respond to user interaction such as web sites, service layers, etc are hosted as "web roles" while those back end services are "worker roles".

Then we have instances. An instance is how many virtual machines are provisioned to provide the functionality of a given role. For example, I might need my presentation tier to have 5 instances because it takes a lot of load. So, my 1 web role has 5 instances. Likewise my middle tier, a service layer, might only need 3 instances (because of presentation tier caching) and so therefore my 1 web role has 3 instances. My back end service might only need 1 instance since its job can be done whenever, but if the back log gets too big, it could scale up to 10 instances to get through the work, then scale back down to 1 instance again.

So the key here is that you can have 1 or more instances per role. Because of this relationship it makes sense that you can have only one role per instance (since an instance is 'instantiated' from a single role template).

What Rinat was trying to say above was that you can cheat with the worker role and actually host a http end point in WCF, thus getting web role type behavior, however you don't get the load balancing of a web role when you do this. Likewise, a web role can have worker role style behavior by overriding the OnStart method in the WebRole.cs. However I would still argue this is just one role in both cases, and you can have multiple instances of that role.

Bjorn was indicating that by default you are capped at 20 instances per role, however you can get more (so he doesn't deserve a -1 IMHO).

Hope this clears it up.

Barolet answered 27/8, 2010 at 11:38 Comment(2)
Yes I think you are right people are confused. I understand what a role is it just seems that in some cases 1 instance per role would be overkill, especially when the smallest instance has almost 2gb of ram. But I you have and others answered my question thanks !Benedict
Well, one could (in theory) have a webrole running inside IIS and a worker role running inside App Fabric (not on port 80/443 of course). BOTH roles would scale with instances but it's hard/impossible in practice ...Dak
K
11

You can have only one role per instance.

However, you can host Http endpoint in your worker role, effectively turning it into Web+Worker role.

References and samples:

Kyongkyoto answered 27/8, 2010 at 9:59 Comment(0)
B
4

By default one web role can have 20 instances. If you need more you can contact the Azure Service Desk and they will turn it up!

Bratislava answered 27/8, 2010 at 9:9 Comment(1)
Thanks I wasn't aware there was an upper limit.Benedict

© 2022 - 2024 — McMap. All rights reserved.