locked
Slow initial download speed with Block Blob Storage RRS feed

  • Question

  • Using the NuGet package WindowsAzure.Storage to access Blob storage, I have come across a speed problem on first download. Whenever I start my test application and perform 5 downloads to test speed, the first one is always significantly slower. This would be problematic in production so I am trying to find a cause/solution.

    I am using Block Blobs and access them like this

                // Create the blob client.
                CloudBlobClient blobClient = _cloudStorageAccount.CreateCloudBlobClient();
    
                // Retrieve reference to a previously created container.
                CloudBlobContainer container = blobClient.GetContainerReference(_containerName);
    
                // Retrieve reference to a blob
                var blob = container.GetBlockBlobReference(imageMetadata.BlobName);
    
                // Get blob contents
                byte[] fileData = new byte[imageMetadata.dataSizeInBytes - 1];
                blob.DownloadToByteArray(fileData, 0);
    


    The speeds I am finding for each of those steps on the first download are 

    Create Client 5.8752 ms
    Container Reference 1.958 ms
    Blob Reference 1.958 ms
    Download Bytes 446.56 ms

    After the first download, each image then has around 80 ms for the download. I am hoping to find out if there is anything that can be done to prevent this performance hit. I would like to avoid downloading a 1 byte blob initially as that is not a clean enough solution.

    Thanks

    Thursday, September 14, 2017 8:43 AM

All replies