Reputation: 17273
I want to simplify the creation of background tasks in Azure everyone.
Background tasks have always been difficult in asp.net applications. For simple scenarios you can periodically call a URL or spin up a background thread. Both of these options have issues and both are far from ideal. For example when calling a URL there are limits on the amount of time that a request can run, it breaks the request correlation with a Unit of Work and you need to manage an external component as part of your application. For background threads it's a little better but IIS is still a request driven service and there are dangers when implementing recurring background tasks. There's work being done at the moment to support background tasks natively in IIS but that's still in the distant future. Today the recommended approach is to use a Windows Service and that's fine because it's not PAAS, there is no reason not to use the whole server.
Azure faces similar issues when it comes to background tasks, simple tasks are easy but if you want anything bigger you jump all the way to a Worker Role. However even if you do use these methods they still have their share of problems.
Simple tasks can be run with Azure Mobile Services Task Scheduling but even those have a few problems. Such as when tasks are long running. It also means you have half you task logic in your main application and half in the form of scripts that manage the rest of the work. I'd like a background service that stays all in one place.
Worker Roles are fair too heavyweight most of the time and frankly they're usually overkill. They require an entire dedicated virtual machine when I'd much rather share a single VM between by website and service. Then later have the ability to scale them independently if I need to.
I think that azure needs a third option. The ability to deploy a service using PAAS that can run in a shared or reserved/standard environment. This should behave exactly like the current Azure Website in that it can run in a shared mode or on a reserved VM with other Websites I'm hosting in Azure. Then that service and my websites could run all in one VM for a cost effective stagey or across as many dedicated VMs as I wanted.
So I have two questions:
What is the best way of doing this today, is there an option that I've missed?
Is Azure going to add a service like this in the future?
Upvotes: 2
Views: 2026
Reputation: 17273
Great news..
Introducing Windows Azure Web Jobs
So now you can have a single PaaS website and background services without even looking at Workers or Roles!
Upvotes: 6
Reputation: 10985
A couple of options for you:
http://www.voiceoftech.com/swhitley/index.php/2011/07/windows-azure-task-scheduler/ http://www.bondigeek.com/blog/2011/03/25/runninginstalling-a-windows-service-in-an-azure-web-role/
Both of them make use of startup tasks to either set up a scheduled task or a Windows Service. These would only work for a Cloud Service, not a Windows Azure Web Site. There is NO current way to do these with WAWS that I'm aware of.
And as far as requesting this to be added to the WAWS or Cloud Service offerings I'd recommend posting here: http://www.mygreatwindowsazureidea.com/forums/34192-windows-azure-feature-voting
Upvotes: 0