Search code examples
data-access-layerasp.net-web-api2azure-worker-rolesazure-table-storageazure-cosmosdb

Would you put data access in an Azure Worker Role?


I'm building an ASP.NET MVC 5 app that will run on Azure. I'm using DocumentDb and Azure Table Storage for managing my data.

I'm thinking about moving my DAL functions to an Azure Worker Role that I call from my web role using HTTP -- not message queue.

I think, typically, worker roles are used for time-insensitive back-end jobs but I see no reason why I couldn't move my DAL to a worker role that responds to HTTP requests. I think this would give me nice separation for my data layer and pretty easy way to scale up/out.

This is making even more sense to me ever since I switched to DocumentDb and Azure Table Storage that require some extra work handling data. I thought a worker role would be ideal for handling all that extra work as it can scale up much more easily.

Anyway, I wanted to get others' suggestions and perspective on this. Please let me know what you think.


Solution

  • Worker roles do not have IIS, which is why they are normally used in conjunction with message queues. If you want your DAL to be a Web API for example then just use another Web role.