Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to choose blob block size in Azure

I want to use Append blobs in Azure storage. When Im uploading a blob, I should choose the block size. What I should consider when choosing the block size? I see no difference if Im uploading a file which has bigger size then block size. How to choose the right block size?

like image 348
Avihu28 Avatar asked Jun 27 '17 08:06

Avihu28


People also ask

What is default size of block blobs in MB?

Block blobs Block blobs are used to hold text or binary files up to ~5 TB (50,000 blocks of 100 MB) in size.

How do you get Azure blob size?

7. Inside the Properties view you will have a button at the bottom to “Calculate Size”. Click on this button to get the size of the Container.


2 Answers

According to your description, I did some research, you could refer to it for a better understanding about blocks of append blob:

I just checked the CloudAppendBlob.AppendText and CloudAppendBlob.AppendFromFile. If the file size or text content size less than 4MB, then it would be uploaded to a new individual block. Here I used CloudAppendBlob.AppendText for appending text content (byte size less than 4MB) three times, you could refer to the network traces as follows:

enter image description here

For content size > 4MB, then the client SDK would divide the content into small pieces (4MB) and upload them into each blocks. Here I uploaded a file with the size about 48.8MB, you could refer to the network traces as follows:

enter image description here

As Gaurav Mantri mentioned that you could choose small block size for low speed network. Moreover, for small block size write, you would retrieve the better performance for write requests, but when you reading data, your data spans across multiple separate blocks, it would slow down your read requests. It depends on the write/read ratio your application expected, for optimal reads, I recommend that you need to batch writes to be as near 4MB as possible, which would bring you with slower write requests but reads to be much faster.

like image 199
Bruce Chen Avatar answered Sep 30 '22 10:09

Bruce Chen


A few things to consider when deciding on the block size:

  • In case of an Append Blob, maximum size of a block can be 4 MB so you can't go beyond that number.
  • Again, a maximum of 50000 blocks can be uploaded so you would need to divide the blob size with 50000 to decide the size of a block. For example, if you're uploading a 100MB file and decide to choose 100 byte block, you would end up with 1048576 (100x1024x1024/100) blocks which is more than allowed limit of 50000 so it is not allowed.
  • Most importantly, I believe it depends on your Internet speed. If you have a really good Internet connection, you can go up to 4MB block size. For not so good Internet connections, you can reduce the limit. For example, I always try to use 256-512KB block size as the Internet connection I have is not good.
like image 38
Gaurav Mantri Avatar answered Sep 30 '22 09:09

Gaurav Mantri