Software Quality

May 13, 2015

Azure Storage – Premium Storage Only Works with Page Blobs

Filed under: Uncategorized — Tags: — David Allen @ 4:32 am

I play to learn. My latest test was educational, and I’m sharing it in case others encounter it.

I ran into problems while playing around with Premium blob storage. I was testing blob storage, comparing performance between Regular and Premium storage, while uploading a 5 MB file. I found my error. I was trying to use block blobs on Premium storage, and only Page Blobs are permitted. But I did not realize that at first. Here was my diagnostic path, with errors to help others who may make the same mistake and search for the errors.

The test works fine on standard LRS (Locally Redundant Storage). But when I test on a Premium storage account, the test fails. An excerpt of the test code is very simple as follows

static void Main(string[] args)

{

var storageConnectionString = premiumLRS_Storage;

CloudStorageAccount account = CloudStorageAccount.Parse(storageConnectionString);

CloudBlobClient client = account.CreateCloudBlobClient();

CloudBlobContainer container = client.GetContainerReference(“demo”);

container.CreateIfNotExists();

CloudBlockBlob blob = container.GetBlockBlobReference(“test.blob”);

string sourceFilePath = @”D:\TestData\5MB.zip”;

blob.UploadFromFile(sourceFilePath, FileMode.Open, null, null);

}

When it reaches the last line, it crashes with the following error.

 Unhandled Exception: Microsoft.WindowsAzure.Storage.StorageException: The remote server returned an error: (400) Bad Request. —> System.Net.WebException: The remote server returned an error: (400) Bad Request.

   at System.Net.HttpWebRequest.GetResponse()

   at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)

   — End of inner exception stack trace —

   at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)

   at Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob.UploadFromStreamHelper(Stream source, Nullable`1 length, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)

   at Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob.UploadFromFile(String path, FileMode mode, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)

   at BlobStorage101.Program.Main(String[] args) in d:\xxxx\AzureDrills\BlobStorage101\Program.cs:line 35

Press any key to continue . . .

 Articles I studied

http://stackoverflow.com/questions/24470217/cannot-upload-to-azure-blob-storage-the-remote-server-returned-an-error-400

This was a good one. It had good debugging ideas.

I tried using Fiddler as suggested. I noticed I was using the WindowsAzure.Storage version 4.3.0

WA-Storage/4.3.0 (.NET CLR 4.0.30319.0; Win32NT 6.2.9200.0)

I went to NuGet Package Manager, noticed Preview updates for 4.3.1, , 4.3.2, 4.4.0.

I tried upgrading to 4.4.0 Preview. I got the same failure.

I tried a simpler operation UploadText instead of UploadFromFile, like this

blob.UploadText(“Hello World!”);

I got the same failure.

I created a second PremiumLRS storage account. I got the same failure.

I debugged and examined the exception and got greater insight

Exception {“The remote server returned an error: (400) Bad Request.”}
ExtendedErrorlnformation {Microsoft.WindowsAzure.Storage.StorageExtendedErrorInformation}
HttpStatusCode 400
HttpStatusMessage Block blobs are not supported.

So, Block blobs are not supported on Premium Storage?

Well, that is correct. According to http://azure.microsoft.com/blog/2014/12/11/introducing-premium-storage-high-performance-storage-for-azure-virtual-machine-workloads/,

“Premium Storage is currently available only for storing data on disks used by Azure Virtual Machines.”

 I know I’ve even read that article. But you know how sometimes details don’t make sense till you need them?

Darn. I wanted to see if I could get higher performance. Now that I think about it, my upload times are probably constrained by my network bandwidth, not the storage subsystems. So I can see that having SSD-backed storage may only make sense for Page Blobs anyway.

Well, that was educational. I’m sharing my experiment in case someone else tries to do what I tried. Most people are probably smarter than me 😉 But when you are experimenting and learning, you are bound to try some things that don’t make sense. How do you know if you don’t try?

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: