如何在Azure中选择Blob块大小 [英] How to choose blob block size in Azure

查看:127
本文介绍了如何在Azure中选择Blob块大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Azure存储中使用Append Blob. 当我上传一个Blob时,我应该选择块大小. 选择块大小时应该考虑什么? 如果我上传的文件的大小大于块大小,则没有任何区别. 如何选择合适的块大小?

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?

推荐答案

根据您的描述,我做了一些研究,您可以参考它以更好地了解附加blob块:

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

我刚刚检查了CloudAppendBlob.AppendTextCloudAppendBlob.AppendFromFile.如果文件大小或文本内容大小小于4MB,则将其上载到新的单独块中.在这里,我使用CloudAppendBlob.AppendText附加了三次文本内容(字节大小小于4MB),您可以参考以下网络跟踪信息:

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:

对于大于4MB的内容,客户端SDK会将内容分成小块(4MB),并将其上传到每个块中.在这里,我上传了一个大小约为48.8MB的文件,您可以参考以下网络跟踪信息:

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:

正如Gaurav Mantri提到的那样,您可以为低速网络选择较小的块大小.此外,对于小块大小的写入,您将获得更好的写入请求性能,但是在读取数据时,数据跨多个单独的块,这会减慢读取请求的速度.这取决于您的应用程序期望的读写比率,为了获得最佳读取效果,我建议您将批处理写入尽可能地接近4MB,这会给您带来较慢的写入请求,但读取速度却要快得多.

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.

这篇关于如何在Azure中选择Blob块大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆