Azure Blob Lease implementation
dazinator opened this issue · 6 comments
Looking at distributed locking purely from an Azure perspective (I have an Azure subscription).
After looking at what mechanisms were available for distributed locking on Azure, one thing that came up was Azure Blob Leases.
It seems "Azure Web Jobs" actually uses this mechanism behind the scenes for singleton jobs that shouldn't be run in parallel - mentioned on answer here:
http://justazure.com/azure-blob-storage-part-8-blob-leases/
Perhaps there is room for an Azure Blob Lease based implementation in this repo in future?
I mention this because I think Azure Blob Leases is probably the simplest way to start using distributed locking (ahead of sql server) for azure subscribers, because all it requires is an azure storage account, which you often have to create anyway to get started.
SQL is the probably the next easiest option then - as that then requires you to add Sql Azure to your azure subscription which adds an extra fee. Not all apps may require Sql server, but most apps do require disk / file storage.
Lastly, third party services like Zookeeper and others are probably the hardest as they require setup of that third party system first.
With that in mind - adding an Azure Blob Lease based distributed lock implementation might be a great addition to this repo.
@dazinator do you have experience working with these, and in particular creating an environment for testing the implementation? Is there a way to run a mock version of blob storage locally or would it need to be tested through an actual Azure account?
@madelson You should be able to run Azure Storage emulator locally, and then develop against that: https://docs.microsoft.com/en-us/azure/storage/common/storage-use-emulator
@dazinator I have an implementation of this built out in the working branch for 2.0 (https://github.com/madelson/DistributedLock/tree/release-2.0/DistributedLock.Azure). If you'd be interested in using it I can look into publishing a prerelease version.
@madelson awesome! A pre-release would be good, as I can then set up some simple POC's with it.
@dazinator sorry I completely missed your follow-up! I've published a prerelease version of the 2.0 packages. You can install the full suite with https://www.nuget.org/packages/DistributedLock/2.0.0-alpha01 or just the azure stuff with https://www.nuget.org/packages/DistributedLock.Azure/.
Let me know if you find any issues!