MSDN Event
WINDOWS AZURE STORAGE
Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay for what the service uses Exposed via RESTful Web Services –Use from Windows Azure Compute –Use from anywhere on the internet Various storage abstractions –Tables, Blobs, Queues, Drives
The Storage Client API The Main API are RESTfuls –Can call these from any HTTP client e.g. Flash, Silverlight, etc… For easier.NET access, a Client API from SDK Microsoft.WindowsAzure.StorageClient –Provides a strongly typed wrapper around REST services
Windows Azure Storage Account User specified globally unique account name –Can choose geo-location to host storage account US – “North Central” and “South Central” Europe – “North” and “West” Asia – “East” and “Southeast” –Can CDN Enable Account Blobs delivered via 18 global CDN nodes –Can co-locate storage account with compute account Explicitly or using affinity groups Accounts have two independent 512 bit shared secret keys 100TB per account
Storage in the Development Fabric Provides a local “Mock” storage Emulates storage in cloud Allows offline development Requires SQL Express 2005/2008 or above There are some differences between Cloud and Dev Storage. A good approach for developers: To test pre-deployment, push storage to the cloud first Use Dev Fabric for compute connect to cloud hosted storage. Finally, move compute to the cloud. There are some differences between Cloud and Dev Storage. A good approach for developers: To test pre-deployment, push storage to the cloud first Use Dev Fabric for compute connect to cloud hosted storage. Finally, move compute to the cloud.
Windows Azure Storage Abstractions
Windows Azure Storage Account
Blob Storage Concepts Blob Container Account cohowinery images PIC01.JPG PIC02.JPG videos VID1.AVI /
Blob Features and Functions
Blob Client Library CloudStorageAccount account = CloudStorageAccount.FromConfigurationSetting("CloudStorageAccount"); CloudBlobClient blobClient = new CloudBlobClient( account.BlobEndpoint, account.Credentials); // Create Container CloudBlobContainer cloudContainer = blobClient.GetContainerReference(containerName); bool hasCreated = cloudContainer.CreateIfNotExist(); // Access Blob in the Container CloudBlob cloudBlob = cloudContainer.GetBlobReference(blobName); //BlobRequestOptions has retry policy, timeout etc. BlobRequestOptions options = new BlobRequestOptions(); //Upload the local file to Blob service cloudBlob.UploadFile(uploadFileName, options); //Download to local file name cloudBlob.DownloadToFile(downloadFileName, options);
Two types of Blobs under the hood
Block Blob Streaming Workload w/ Random Reads + Committed Writes 10 GB Movie Windows Azure Storage Block Id 1 Block Id 2 Block Id 3 Block Id N blobName = “blob.wmv”; PutBlock(blobName, blockId1, block1Bits); PutBlock(blobName, blockId2, block2Bits); ………… PutBlock(blobName, blockIdN, blockNBits); PutBlockList(blobName, blockId1, blockId2…,blockIdN); blobName = “blob.wmv”; PutBlock(blobName, blockId1, block1Bits); PutBlock(blobName, blockId2, block2Bits); ………… PutBlock(blobName, blockIdN, blockNBits); PutBlockList(blobName, blockId1, blockId2…,blockIdN); blob.wmv
Page Blob – Random Read/Write 0 10 GB 10 GB Address Space
Windows Azure Content Delivery Network
Blobs Tips
Windows Azure Drive
Windows Azure Drives Capabilities
Cloud Library Sample //Create Local Storage resource and initialize the local cache for drives CloudDrive.InitializeCache(localCacheDir, cacheSizeInMB); CloudStorageAccount account = CloudStorageAccount.FromConfigurationSetting("CloudStorageAccount"); //Create a cloud drive (PageBlob) CloudDrive drive = account.CreateCloudDrive(pageBlobUri); drive.Create(1000 /* sizeInMB */); //Mount the network attached drive on the local file system string pathOnLocalFS = drive.Mount(cacheSizeInMB, DriveMountOptions.None); //Use NTFS APIs to Read/Write files to drive … //Snapshot drive while mounted to create backups Uri snapshotUri = drive.Snapshot(); //Unmount the drive drive.Unmount();
Windows Azure Tables
Table Storage Concepts EntityTableAccount cohowinery customers Name =… = … Name =… = … winephotos Photo ID =… Date =… Photo ID =… Date =…
Entity Properties
PartitionKey and Partitions
Purpose of the Partition Key
PartitionKey (Category) RowKey (Title) TimestampReleaseDate Action Fast & Furious…2009 Action The Bourne Ultimatum…2007 … ……… Animation Open Season 2…2009 Animation The Ant Bully…2006 PartitionKey (Category) RowKey (Title) TimestampReleaseDate Comedy Office Space…1999 … ……… SciFi X-Men Origins: Wolverine…2009 … ……… War Defiance…2008 PartitionKey (Category) RowKey (Title) TimestampReleaseDate Action Fast & Furious…2009 Action The Bourne Ultimatum…2007 … ……… Animation Open Season 2…2009 Animation The Ant Bully…2006 Comedy Office Space…1999 … ……… SciFi X-Men Origins: Wolverine…2009 … ……… War Defiance…2008 Partitions and Partition Ranges Server B Table = Movies [Comedy - MaxKey) Server B Table = Movies [Comedy - MaxKey) Server A Table = Movies [MinKey - Comedy) Server A Table = Movies [MinKey - Comedy) Server A Table = Movies Server A Table = Movies
Table Operations
Hello Azure Architecture
DEMODEMO Twitter Table
Table Tips
Table Tips – cont. Avoid large table scans when performance is critical Restructure your schema if required Concatenate different keys to form appropriate index Most Optimal: PartitionKey == “SciFi” and RowKey == “Star Wars” Scans: Expect continuation tokens (REST) PartitionKey == “SciFi” and “Sphere” ≤ RowKey ≤ “Star Wars” “Action” ≤ PartitionKey ≤ “Thriller” PartitionKey == “Action” || PartitionKey == “Thriller” - currently scans entire table “Cars” ≤ RowKey ≤ “Star Wars” - scans entire table
Queue Storage Concepts MessageQueueAccount order processing customer ID order ID cohowinery
Loosely Coupled interaction with Queues Azure Queue Input Queue (Work Items)
Queue’s Reliable Delivery Azure Queue Input Queue (Work Items)
DEMODEMO Twitter Queue
Queue Tips