Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I (programmatically) get Azure Blob maximum allowed size?

Is there any way to programmatically retrieve the maximum allowed size for an Azure Blob? Also for a block in a blob?

like image 315
Mirel Vlad Avatar asked May 22 '17 07:05

Mirel Vlad


3 Answers

I know of no way to query the maximum size on demand, but I believe the value you are looking for is stored as a constant in the .net SDK. Constants.MaxBlobSize and Constants.MaxBlockSize in the Microsoft.WindowsAzure.Storage.Shared.Protocol namespace would be the values you are interested in.

/// <summary>
/// The maximum size of a blob with blocks.
/// </summary>
public const long MaxBlobSize = MaxBlockNumber * MaxBlockSize;

With MaxBlockSize being

/// <summary>
/// The maximum size of a single block for Block Blobs.
/// </summary>
public const int MaxBlockSize = (int)(100 * Constants.MB);

Source (Constants.cs)

like image 133
Brunner Avatar answered Nov 02 '22 04:11

Brunner


Taken from https://docs.microsoft.com/en-us/azure/storage/storage-dotnet-how-to-use-blobs#writing-to-an-append-blob

Each block in an append blob can be a different size, up to a maximum of 4 MB, and an append blob can include a maximum of 50,000 blocks. The maximum size of an append blob is therefore slightly more than 195 GB (4 MB X 50,000 blocks).

like image 27
Svek Avatar answered Nov 02 '22 03:11

Svek


Is there any way to programmatically retrieve the maximum allowed size for an Azure Blob? Also for a block in a blob?

As of today, no. There's no programmatic way of retrieving this information. However this information is well published here and it does not changes very often. Since 2008, I believe the size has changed only once and that too for block blobs.

Here're the limits as of today:

Block Blobs

Max Size: 4.75 TB (if you use Service Version 2016-05-31 or greater)

Max Size: 195 GB (if you use Service Version prior to 2016-05-31)

Max Block Size: 100MB (if you use Service Version 2016-05-31 or greater)

Max Block Size: 4MB (if you use Service Version prior to 2016-05-31)

Max Number of Blocks: 50000

Page Blobs

Max Size: 1TB

Append Blobs

Max Size: 195GB

Max Block Size: 4MB

Max Number of Blocks: 50000

like image 20
Gaurav Mantri Avatar answered Nov 02 '22 05:11

Gaurav Mantri