Worker versus Web Work

From what I understand, small repetitive tasks are performed in the cloud.

What are the reasons and in what situations can I choose one of them?

+56
azure azure-worker-roles azure-webjobs
Sep 13 '14 at 16:33
source share
3 answers

Basic information:

WebJobs are good for lightweight work items that donโ€™t need to set up the environment in which they work and do not consume a lot of resources. They are also very good for tasks that need to be run only periodically, on a schedule, or run. They are cheap and easy to set up / run. They run in the context of your website, which means that you get the same environment that your website runs on, and any resources that they use are resources that your website cannot use.

Worker roles are good for more demanding workloads or if you need to change the environment in which they work (for example, a specific version of the .NET framework or something installed on the OS). Worker roles are more expensive and a little harder to set up and run, but they offer significantly more power.

In general, I would start with WebJobs and then move to Worker Roles if you find that your workload requires more than WebJobs has to offer.

+76
Sep 14 '14 at 2:04
source share

If we need to measure "power" as computing power, then in a virtual environment this translates to how many layers are on top of a physical machine (metal). The user code in the virtual machine runs on top of the hypervisor that controls the physical machine. This is the thickest layer. Whenever possible, the hypervisor simply tries to serve as the passage of metal.

WebJobs has a fundamentally small overhead. It is sandboxed, OS supported, and there are services and modules to make sure it works. But the application code is essentially close to metal, as in Worker Roles, because they use the same hypervisor.

If what you want to measure is โ€œflexibility,โ€ then use Worker Roles because it is not managed or isolated, it is more flexible. You can use more sockets, define your own environment, install more packages, etc.

If you need "functions", then WebJobs has a complete set of functions. Including virtual network resources on preliminary resources, an intermediate environment, remote debugging, startup, scheduling, easy connection to the storage and service bus, etc.

Most people want to focus on solving their problem, rather than investing time in infrastructure. You use WebJobs for this. If you find that you need more flexibility, or if an isolated security environment does not allow you to do something that cannot be accomplished in any other way, go to Worker Roles.

You can even create hybrid solutions where some parts run in WebJobs and others in Worker Roles, but that is beyond the scope of this question. (hint: WebJobs SDK)

+19
Mar 26 '15 at 19:33
source share

Recognition when choosing to use a web job or a worker role:

  • The worker role is performed independently on a dedicated virtual machine, the web task is placed in the web application container.

  • The worker role will scale independently, the web task will scale along with the web application container.

Web tasks are ideal for polling RSS feeds, checking and processing messages, and sending notifications; they are lightweight and cheaper than workbooks, but less effective.

+9
Jul 11 '16 at 9:49
source share



All Articles