1
votes

Problem background: (Simplified, but same idea) A scalable web-service that adds two numbers and returns result. There is no state being saved. The client sends a HTTP POST where the 2 numbers to be added are part of the body. The Server adds the numbers and responds with the summation in the body of the HTTP response.

Question: I want to deploy the service on Azure. Should I create a web-role or a worker-role? Which would be more performant for the above stated problem?

I tried creating a prototype using worker-role and there are parts (like handling application/xml mime types in http-post) which seem to be difficult to do in a worker role. Things like the GlobalConfiguration classes are unavailable by default.

2

2 Answers

2
votes

Question: I want to deploy the service on Azure. Should I create a web-role or a worker-role? Which would be more performant for the above stated problem?

Between Web Role and Worker Role, the answer would be Web Role. Reason being IIS comes preinstalled in a Web Role whereas you would need to install IIS (or some other web server) in a Worker Role for it to process HTTP requests. Worker Roles are more suitable for performing background tasks which does not require user interaction (think of them as Services running on your local computer).

Performance wise, I believe both of them will be the same because in both cases you are getting same VM.

Having said that, there are other alternatives available to you when it comes to hosting your web service. You could use Web Apps which provides a very simple deployment model (as compared to Cloud Services). If your application is going to be an API only, you could use Azure API Apps only. Yet another alternative would be to use Azure API Management Service. You may want to look at these services as well before deciding on Cloud Service (Web/Worker role).

2
votes

Depending on the implementation of the web-service, the typical priority would be to only take on the responsibility of a layer in the infrastructure if you have to. E.g. Apps Services gives you the least responsibility, but is a good option if you implement the web-service in ASP.NET, node.js, php and more. Web Roles gives you more control over the IIS part and still supports ASP.NET, php and more. A worker role is typically used for OWIN implementations of a web-service - i.e. you do not rely on IIS.

/Mikkel