简体   繁体   English

下载大型 Azure 存储 Blob 的最快方法?

[英]Fastest Method for Downloading Large Azure Storage Blobs?

I'm working on a project in C# where I need to quickly download potentially large blobs from azure storage to a local file using the Azure.Storage.Blobs SDK v12. I'm working on a project in C# where I need to quickly download potentially large blobs from azure storage to a local file using the Azure.Storage.Blobs SDK v12. However, the times I'm getting when trying to download a Blob that's about 2.8 GB in size is a bit slow for my needs.但是,尝试下载大小约为 2.8 GB 的 Blob 时,对于我的需求来说,我的时间有点慢。

I'm using the DownloadToAsync method that I've seen suggested elsewhere:我正在使用我在其他地方看到的 DownloadToAsync 方法:

Response response = await blob.DownloadToAsync(
   destinationPath,
   blobDownloadToOptions,
   cancellationToken).ConfigureAwait(false);

The blobDownloadTo options contains my TransferOptions, which are basically: blobDownloadTo 选项包含我的 TransferOptions,它们基本上是:

MaximumConcurrency = 8
InitialTransferSize = blobSize / 8
MaximumTransferSize = blobSize / 8

And also my progress handler which let's me know how fast the download is going.还有我的进度处理程序,它让我知道下载的速度有多快。 When I run it locally using Azure Emulated Storage, I can see via Fiddler than the request is happening across the desired number of threads and it only takes around 6-7 seconds.当我使用 Azure 模拟存储在本地运行它时,我可以通过 Fiddler 看到请求是在所需数量的线程上发生的,并且只需要大约 6-7 秒。 But once it's deployed to my service, the request suddenly takes ~30 seconds.但是一旦它部署到我的服务中,请求突然需要大约 30 秒。

Download Progress: (356725906) in : (4361) ms.
Download Progress: (713461892) in : (8704) ms.
Download Progress: (1070184646) in : (11687) ms.
Download Progress: (1426907400) in : (16048) ms.
Download Progress: (1783630154) in : (19321) ms.
Download Progress: (2140352908) in : (23769) ms.
Download Progress: (2497075662) in : (26981) ms.
Download Progress: (2853782037) in : (30178) ms.

Are there any tips or recommendations people have that'll help me up my perf?人们是否有任何提示或建议可以帮助我提高性能? I'm unable to utilize the DataMovement Library as it's not compatible with v12.我无法使用DataMovement 库,因为它与 v12 不兼容。

• I would suggest you to please use the Azure speed test tool to test the speed of the blob data being downloaded . • 我建议您使用Azure 速度测试工具来测试正在下载的blob 数据的速度 The Azure Speed test tool download link is given below: - Azure测速工具下载链接如下:-

https://www.azurespeed.com/Azure/Download https://www.azurespeed.com/Azure/Download

Also, would suggest you to please use the 'AzCopy' tool to check whether you are getting the same download speeds through it as it would clear your doubts about any network drops .此外,建议您使用“AzCopy”工具检查您是否通过它获得相同的下载速度,因为它可以消除您对任何网络丢失的疑虑

• You can also check the below link for Azure storage resource performance and the scalability checklist which can surely help you to enhance the downloading speed of the blobs : - • 您还可以查看以下链接,了解Azure 存储资源性能和可扩展性清单,这肯定可以帮助您提高 blob 的下载速度:-

https://docs.microsoft.com/en-us/azure/storage/blobs/storage-performance-checklist?toc=%2Fazure%2Fstorage%2Fblobs%2Ftoc.json#subheading2 https://docs.microsoft.com/en-us/azure/storage/blobs/storage-performance-checklist?toc=%2Fazure%2Fstorage%2Fblobs%2Ftoc.json#subheading2

Finally, you can try to use the following code for downloading blob from the Azure storage as well as suggest you use the 'StorageTransferOptions' class in the.Net Azure SDK code in which you can specify the 'MaximumConcurrency' and 'MaximumTransferSize' parameters and variables accordingly to maximize the download speed of the blobs from the Azure storage . Finally, you can try to use the following code for downloading blob from the Azure storage as well as suggest you use the 'StorageTransferOptions' class in the.Net Azure SDK code in which you can specify the 'MaximumConcurrency' and 'MaximumTransferSize' parameters and variables accordingly to maximize the download speed of the blobs from the Azure storage

var ms = new MemoryStream();
await blobClient.DownloadToAsync(ms).ConfigureAwait(false);
var blobStream = await blobClient.OpenReadAsync().ConfigureAwait(false);
var props = await blobClient.GetPropertiesAsync().ConfigureAwait(false);
return File(blobStream, props.Value.ContentType, blobClient.Name);

For more detailed information, you can surely refer the below community thread link and the link below for more clarification: -有关更多详细信息,您当然可以参考下面的社区线程链接和下面的链接以获得更多说明:-

Downloading blob results in more memory being used than size of actual blob 下载 blob 导致使用的 memory 比实际 blob 的大小更多

https://docs.microsoft.com/en-us/answers/questions/89440/getting-very-slow-speed-while-downloading-storage.html https://docs.microsoft.com/en-us/answers/questions/89440/getting-very-slow-speed-while-downloading-storage.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM