Is it a good idea to reuse an Azure web role for backend processing?

后端 未结 3 1650
孤城傲影
孤城傲影 2020-12-20 20:42

I\'m porting a huge application to Windows Azure. It will have a web service frontend and a processing backend. So far I thought I would use web roles for servicing client r

相关标签:
3条回答
  • 2020-12-20 21:37

    From what I understand your are asking if it makes sense to consolidate service layers so that you only have to deal with a single layer. At a high level, I think that makes sense. The simpler the better, as long as it's not so simple that you can't meet your primary objectives.

    If your primary objective is performance, and the calls to your services are inline (meaning that the caller is waiting for an answer), then consolidating the layers may help you in achieving greater performance because you won't have to deal with the overhead of additional network latency of additional physical layers. You can use the Task Parallel Library (TPL) to implement your threading logic.

    If your primary objective is scalability, and the calls to your services are out-of-band (meaning that the caller implements a fire-and-forget pattern), then using processing queues and worker roles may make more sense. One of the tenets of cloud computing is loosely coupled services. While you have more maintenance work, you also have more flexibility to grow your layers independendly. Your worker roles could also use the TPL mentioned above so that you can deploy your worker roles on larger VMs (say with 4CPUs, or 8), which would keep the number of instances deployed to a minimum.

    My 2 cents. :)

    0 讨论(0)
  • 2020-12-20 21:40

    I would suggest you to develop them as separated roles: a web role and a worker role, and then just combine them into a single web role.

    this way, in the future you can easaly convert to real separated roles, if needed.

    for more details: http://www.31a2ba2a-b718-11dc-8314-0800200c9a66.com/2010/12/how-to-combine-worker-and-web-role-in.html http://wely-lau.net/2011/02/25/combining-web-and-worker-role-by-utilizing-worker-role-concept/

    0 讨论(0)
  • 2020-12-20 21:41

    Sounds like you already have a pretty good idea of what to think about when using multiple roles:

    • Cost for 2 instances to meet SLA (although some background tasks really don't need SLA if the end user doesn't see the impact)
    • Separate scale units

    However: If you run everything in one role, then everything scales together. If, say, you have an administrative web site on port 8000, you might have difficulty reaching it if your user base is slamming the main site on port 80 with traffic.

    I blogged about combining web and worker roles, here, which goes into a bit more detail along what we're discussing here. Also, as of some time in March, the restriction of 5 endpoints per role was lifted - see my blog post here for just how far you can push endpoints now. Having this less-restrictive endpoint model really opens up new possibilities for single-role deployments.

    0 讨论(0)
提交回复
热议问题