Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is downloading from Azure blobs taking so long?

In my Azure web role OnStart() I need to deploy a huge unmanaged program the role depends on. The program is previously compressed into a 400-megabytes .zip archive, splitted to files 20 megabytes each and uploaded to a blob storage container. That program doesn't change - once uploaded it can stay that way for ages.

My code does the following:

CloudBlobContainer container = ... ;
String localPath = ...;
using( FileStream writeStream = new FileStream(
             localPath, FileMode.OpenOrCreate, FileAccess.Write ) )
{
     for( int i = 0; i < blobNames.Size(); i++ ) {
         String blobName = blobNames[i];
         container.GetBlobReference( blobName ).DownloadToStream( writeStream );
     }
     writeStream.Close();
}

It just opens a file, then writes parts into it one by one. Works great, except it takes about 4 minutes when run from a single core (extra small) instance. Which means the average download speed about 1,7 megabytes per second.

This worries me - it seems too slow. Should it be so slow? What am I doing wrong? What could I do instead to solve my problem with deployment?

like image 206
sharptooth Avatar asked Jan 18 '23 18:01

sharptooth


2 Answers

Adding to what Richard Astbury said: An Extra Small instance has a very small fraction of bandwidth that even a Small gives you. You'll see approx. 5Mbps on an Extra Small, and approx. 100Mbps on a Small (for Small through Extra Large, you'll get approx. 100Mbps per core).

like image 181
David Makogon Avatar answered Jan 21 '23 07:01

David Makogon


The extra small instance has limited IO performance. Have you tried going for a medium sized instance for comparison?

like image 26
Richard Astbury Avatar answered Jan 21 '23 08:01

Richard Astbury