다음을 통해 공유


Azure Storage Blobs: the API DownloadToStream is always faster than OpenRead

An interesting finding when using the Azure Storage is that the API ICloudBlob.DownloadToStream is always over 35% faster than ICloudBlob.OpenRead, no matter the Blob is page Blob or block Blob. The Storage Client Library we use is 2.0.0.

Here is the different codes for the two APIs:

  • DownloadToStream: blob.DownloadToStream(stream);
  • OpenRead:                var blobStream = blob.OpenRead();      blobStream.CopyTo(stream);

The following table gives the test result of different APIs. The duration is the average of 10 times' running.

Data Size Open Read Stream (ms) Download To Stream (ms) Faster Ratio
10 KB 44.1 26.5 66.42%
100 KB 47.9 24.3 97.12%
1 MB 146.8 106.1 38.36%
10 MB 1088.5 754.7 44.23%
100 MB 11752.6 7892.2 48.91%