I want to execute a job scheduler methods in my windows azure application. So in my application i am using 2 instance of the same application. So If i create a scheduler means both the instance can execute same code. Is it possible to avoid such execution? Or is it possible check other instace before executing the code? For the implementation i am using c#.Net.
Asked
Active
Viewed 264 times
0
-
possible duplicate of [Azure - how do I run a job that calls a function in the webservice every hour?](http://stackoverflow.com/questions/8548159/azure-how-do-i-run-a-job-that-calls-a-function-in-the-webservice-every-hour) – David Makogon Jun 20 '12 at 15:19
-
Also [cloud scheduler](http://stackoverflow.com/q/6457231/272109) – David Makogon Jun 20 '12 at 15:20
-
Also [how to write azure web role - worker role schedule task?](http://stackoverflow.com/q/9193939/272109) – David Makogon Jun 20 '12 at 15:25
1 Answers
1
The most common pattern is a self-electing controller. In this pattern, when these processes start, they attempt to create an exclusive lease on something, say a blob object. The fist process to get the lease is the one that actually performs whatever processing needs to be done. It will also then renew the lease periodicaly to make sure it remains the "controller". Any instances that fail to get the lease then go to sleep and check back later (minutes, seconds, hours...) to see if they can get the lease now and become the controller. This allows for the original controller to crash or be shut down and then another instance will take over the job of being the controller.

BrentDaCodeMonkey
- 5,493
- 20
- 18
-
just one thing that i would like to ask you is when to use put and delete method as there is no explaination about this in azure documentation – I Love Stackoverflow Mar 09 '16 at 05:46
-
Could you please clarify your question? what are you trying to put or delete? Is this in relation to the root question or a separate concern? – BrentDaCodeMonkey Mar 10 '16 at 16:16
-
can you please join this azure room so that we can discuss something please:http://chat.stackoverflow.com/rooms/105628/azure – I Love Stackoverflow Mar 11 '16 at 03:25