Distributed locking mechanism .NET
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:
Allow once instance of a method to run at any one time. (OS mutex).
Must work in a multi server environment.
Mutex must be dropped if process dies.
Must be a robust and mature solution.
Environment:
Windows Server (on premise)
.Net
Azure
Things I have considered so far:
OS mutex: Works for on premise, unsure if it will release the lock on
process death. Also unsure if windows supports a robust mutex.
DB Flag: Works for on premis, works in multi-server. Won't unlock on
process death.
AppFabric: Works on premise though an extra setup step is undesirable.
Works multi-server. Won't unlock on process death though locks can be set
to time out when acquired. (best so far)
CIFS File lock: Works on premise, works multi-server, should unlock on
process death. Fails the robust test though this may be personal bias.
I imagine this is a fairly common problem and I'm interested to hear how
the community commonly solves it.
No comments:
Post a Comment