robertkroll
robertkroll

Reputation: 8794

Acquiring multiple leases on blobs

If I have multiple compute instances that try to acquire a lease on the same blob at the same time, it seems to succeed quite often. I was under the impression that once a lease was given out (and thus, acquired by the client) it should be impossible for another to be given out at the same time?

I hope this is the case, I have been using blob leases as distributed locks in Azure.

Upvotes: 1

Views: 1401

Answers (2)

user94559
user94559

Reputation: 60153

As long as a lease is held, another lease cannot be acquired. But leases expire after a minute if not renewed.

Upvotes: 0

AvkashChauhan
AvkashChauhan

Reputation: 20576

You need to read This article "Managing Concurrency in Windows Azure with Leases" from the @Smarx to get the exact answer:

By @Smarx: "A lease is the distributed equivalent of a lock. Locks are rarely, if ever, used in distributed systems, because when components or networks fail in a distributed system, it’s easy to leave the entire system in a deadlock situation. Leases alleviate that problem, since there’s a built-in timeout, after which resources will be accessible again."

http://blog.smarx.com/posts/managing-concurrency-in-windows-azure-with-leases

Upvotes: 2

Related Questions