Getting very slow speed while downloading storage blob.

sxcsacsac 1 Reputation point
2020-09-14T09:00:19.177+00:00

Hello,
I am getting very slow speed while downloading the storage blob from Azure storage account. I am using .net core 3.1 web api application to download it and return it with api response. Following is the code.

BlockBlobClient blockBlobClient = blobContainerClient.GetBlockBlobClient(filepath);

if (await blockBlobClient.ExistsAsync() == false)
{
return BadRequest("blob " + blockBlobClient.Name + " is not present");
}

Stream blockBlobStream = await blockBlobClient.OpenReadAsync();

return File(blockBlobStream, blockBlobClient.GetProperties().Value.ContentType, blockBlobClient.Name);

Azure account details
Performance tier: Standard/Hot
location: Central US, East US 2
replication: Geo-redundant storage (GRS)
account kind: BlobStorage

I am not getting whether this is the issue in my code or should I use any other method to download or is it the problem from Azure storage account or bandwidth related issue. Kindly please let me know if anyone knows the solution.

Thanks in advance..

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,576 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Krish G 2,331 Reputation points
    2020-09-14T13:40:10.9+00:00

    @sxcsacsac , From code optimization perspective, I have modified your code as below for a faster download. Note I am using DownloadToAsync using a helper memory stream which would enable downloading using parallel requests. Also. I changed blockBlobClient.GetProperties() to async variation to avoid blocking call.

    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);  
    

    If you still face the issue after the code change, please let me know to look into other possibilities of bandwidth issue, network latency etc.


  2. Sumarigo-MSFT 44,906 Reputation points Microsoft Employee
    2020-09-17T10:28:12.527+00:00

    @sxcsacsac Following up on this thread to check, if the above suggestion was helpful. And, if you have any further query do let us know.
    Just checking in to see if the above answer helped. If this answers your query, please don’t forget to "Accept the answer" and Up-Vote for the same, which might be beneficial to other community members reading this thread. And, if you have any further query do let us know.

    If the issue still persists, May I know what download speed are getting and How much data are you downloading?
    You can use Azure speed test tool to check the speed: https://www.azurespeed.com/Azure/Download

    There is similar discussion threads, You may also refer to the suggestion mention in this Q&A forum and GitHub and let me know the status.
    Can you try downloading same data using azcopy tool and check are you getting the same download speed?

    Additional information: There is no throttling on the Azure side below the published 60 MB/s scalability target for a single blob. If the network and client machine can handle the traffic then we will send it.

    Here's a guide for troubleshooting high E2E latency: https://learn.microsoft.com/en-us/azure/storage/common/storage-monitoring-diagnosing-troubleshooting#metrics-show-high-AverageE2ELatency-and-low-AverageServerLatency

    You can also, refer the below documentation for azure storage performance. If it doesn’t I would recommend you create a technical support ticket to find the root cause of the issue. The ticket enables you to work closely with the support engineers and get a quick resolution for your issue. If you don't have the support plan we will try and help you get a one-time free technical support. In this case, could you send an email to AzCommunity[at]Microsoft[dot]com referencing this thread as well as your subscription ID. Please mention "ATTN subm" in the subject field. Thank you for your cooperation on this matter and look forward to your reply.

    Microsoft Azure Storage Performance and Scalability Checklist

    Hope this helps! Kindly let us know if the above helps or you need further assistance on this issue.

    ---------------------------------------------------------------------------------------------------------------------------------------