Andrea Danti - Fotolia
The differences between web roles and worker roles in Azure
What sets web roles and worker roles apart in Microsoft's Azure Cloud Services? Here's a look at how they are different.
Microsoft's Azure Cloud Services is a PaaS where customers can deploy, manage and run scalable applications in the cloud without managing the servers themselves.
When working with the cloud platform, there are two Azure service roles on which an application can be installed: web roles or worker roles. The main difference between the two is how the VM is hosted:
- A web role is a Microsoft server VM running Internet Information Services (IIS).
- A worker role is a Microsoft server VM not running IIS.
Essentially, the web role has IIS installed, and workers run the application. To get a little more specific, web roles deploy and host applications through IIS. Therefore, they use programming languages supported by IIS, such as ASP, ASP.NET and PHP. An example of a web role is a simple application serving a website.
Worker roles run stand-alone applications that are not on IIS. These Windows Server executables perform tasks such as processing, running scripts or compressing images, as well as supporting background processes and service-level tasks that don't use IIS.
It is important to note that an application can use web roles and worker roles simultaneously in the same Azure instance. A web role, for example, may collect end-user requests and then pass them to a worker role to process.
Choosing, scaling and managing roles in Azure
Deciding which role to use within an architecture depends on the application and how it is being used. For example, if the front-end application needs its own application server, then systems to support the web role in the worker role are needed. All application servers run in the same cloud instances, but they are used with different functions. Since Azure Cloud Services is a PaaS offering, you must select a mode in which to run it, and that decision should be based only on the application, not the OS being used.
While web roles and worker roles are selected during install, they can be adjusted or added during the process. You can scale up the platform if more resources are needed from a web or worker role -- simply request more VMs, and Azure will create them. If the load decreases, VMs can be deprovisioned.
With Azure service roles, you're not installing OSes; you're installing applications. Take advantage of the staging environment during quality assurance to decide if the application is working as expected before deploying it into production.
The platform is managed by Azure. Your applications' specific web and worker roles can be monitored through Azure Cloud Services and the Azure portal. Additional security and management software may also be required in certain deployments, so assess your organization's management and security needs pre-adoption.