Reputation: 741
We have a requirement to manage concurrent operations of a task. In short only one version of this task can be running at any one time.
The issue is we will be running in a multi-server environment.
Requirements:
Environment:
Things I have considered so far:
I imagine this is a fairly common problem and I'm interested to hear how the community commonly solves it.
I'm specifically interested in hearing thoughts on the CIFS locking solution or if MSMQ could be used?
Upvotes: 2
Views: 1474
Reputation: 2583
If you are OK using Windows Azure Storage, then you can use a Windows Azure Blob to acquire a lease on that blob with a timeout (the max you can use is 1 minute). The server that acquires the lease can run the task, and it can keep renewing the lease before it expires.
Other servers will continue to try and acquire the lease, in case the leader process dies.
How often you poll depends on how critical it is for other processes to immediately resume, but can probably lead to some extra cost (which might not be marginal if its too frequent and depending how many servers you have polling competing for that lease).
Upvotes: 1