What do you use worker role for in Azure?

Web servers tend to go down when serving more load than it can handle. Memory filled to the max and causing heavy grind on harddrives swapping information in and out. Processors spike to 100%, and it's only a matter of time before the whole system grinds to a halt. In azure, having service architecture that consist of roles allow application to scale horizontally by adding more instances. The platform handles the hardware scalability for you.

Azure is a fairly new technology. It's exciting and I'm having a good time learning about it. There are currently 2 roles present in the current version of Azure: web role and worker role. Both can make outbound connection to Internet resources via HTTPS/HTTPS on TCP/IP sockets, but only web role are accessible via http/https endpoints.

azure architecture from msdn

schema taken from Understanding Service Architecture

This is the coolbit. Having two separate roles joined by a queue allow the developer to split tasks into 2 components. We put the cheap inexpensive task of handling UI in web role, whilst putting the more resource intensive less time sensitive task into the worker role. When numerous requests for generating thumbnail, for example, comes in; all the web role has to do is put them into a queue. The worker role will fetch the jobs at its own leisure.

azure funnel

Imagine having this sort of power for heavy calculation, data fetching, or accessing valueable service. The technique will decrease the possibility of server crashes by flattening the load. The throughput remains the same as the queue funnels all the requests to a manageable load that the worker role instances can handle.

When the queue gets longer, than one could easily add more instances of the worker role.

  1. Ronald Widha » Blog Archive » SQL Azure CTP – Quick Overview says:

    [...] Initially I thought Windows Azure was designed only for high scale websites which therefore doesn'.... However, I didn't realize that Microsoft also have SQL Azure. [...]

  2. Teman Macet » Blog Archive » #23 Ngobrol tentang Google Wave says:

    [...] Wave API user group Wave Protocol Wave Protocol user group Microsoft Sync Framework Windows Azure Azure Roles Amazon EC2 berbagi dengan yang [...]