Azure Blob Storage Leasing

Just like any other storage with multiple users, Azure Blob storage must handle multiple users simultaneously. This is easy if all the concurrent users are trying to read the data, but when two or more users want to write to the Blob at the same time, this creates concurrency issues. To solve the issue of concurrent write access to a blob, the concept of Blob leasing has been provided in Azure Blob storage.

A blob lease enables the users to update a blob in a container while ensuring that no other user or process can modify or delete the blob until the update is complete. A blob can have only one active lease at a time. Another user can acquire a lease only after the lease has expired or released.

A lease can be either temporary, lasting 15 to 60 seconds or permanent i.e. until the lease is released.

The following five commands are available to manage Azure Blob storage lease:

  1. Acquire: This is a command for acquiring or starting a lease. User can specify whether the lease is temporary (with duration) or permanent.
  2. Release: This command specifies that the user wants to release the blob for leasing to another user.
  3. Renew: To renew a temporary lease for the same duration as specified at the time of acquiring the lease.
  4. Break: This specifies that the user intends to break or stop the lease but the blob cannot be acquired by other user until it has expired.
  5. Change: To change the ID property of the lease.

There are various interfaces through which the lease can be managed: Azure portal, Azure CLI, .NET, REST API etc.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: