Can we have a working role and a web role in one instance of Azure Cloud Services

I am going to move my site, database and background planner to the Azure platform.

I have to use cloud services with the role of network and worker. Now my question is, do I need separate instances for each type of role, or is one instance able to host several types of role?

+1
source share
2 answers

You cannot have a combined instance of a web role and a worker role. It can be one or the other. However, it is possible that background processing plays a role on the Internet, so it may contain a background workload.

See this SO question for a few options

Azure WebRole Scheduled Task Every morning

This indicates that the task starts every morning. Obviously, you can do this more often, depending on your application.

Remember the scalability limitations of this, though. Once your traffic begins to grow, it will make sense to break it into separate roles on the Internet and workers.

In fact, even if the background workload is light, it might still be wiser for you to switch from a separate architecture from the very beginning and use XS instances for background processing.

+3
source

Technically, you cannot play the role of both types. However, the web role is the same as the worker role; it is simply configured for IIS. Thus, you can combine them into one web role - IIS will start in a separate process, and the entry point of the Run() role will start an endless loop to process the backend. See this similar question .

This will make scaling more difficult. The whole idea of ​​individual roles (remember that you can have not only one web role and one work role, you can have, for example, four work roles and two web roles, if this is suitable for your solution) is that You can scale them separately.

It seems that when you combine the two roles into one, you can no longer scale them. In most cases, this is not so - you just need to change the indicators.

For example, you wanted to run one instance of a web role for every thousand HTTP requests per minute and one instance of a worker role for every ten requests in the backend queue. Well, that means that every thousand HTTP requests need the same amount of processing as ten items in the intermediate queue. Thus, you create a new metric that takes both parameters and displays multiple instances. As you have five thousand requests per minute and twenty requests in the backend queue - you need seven instances of the combined role.

This will not work for all applications, but most of them will use this approach just fine. The bonus is that you avoid cases where any of the roles are idle, because the current load falls into another role.

+2
source

All Articles