MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable,...

36
MSDN Event MSDN Event

Transcript of MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable,...

Page 1: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

MSDN EventMSDN EventMSDN EventMSDN Event

Page 2: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

WINDOWS AZURE STORAGEWINDOWS AZURE STORAGEWINDOWS AZURE STORAGEWINDOWS AZURE STORAGE

Page 3: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

Windows Azure StorageWindows Azure StorageWindows Azure StorageWindows 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

Page 4: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

The Storage Client APIThe Storage Client APIThe Storage Client APIThe 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

Page 5: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

Windows Azure Storage AccountWindows Azure Storage AccountWindows Azure Storage AccountWindows 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

Page 6: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

Storage in the Development FabricStorage in the Development FabricStorage in the Development FabricStorage 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.There are some differences between Cloud and Dev Storage.http://msdn.microsoft.com/dd320275 http://msdn.microsoft.com/dd320275

A good approach for developers:A good approach for developers:To test pre-deployment, push storage to the cloud firstTo test pre-deployment, push storage to the cloud first

Use Dev Fabric for compute connect to cloud hosted storage.Use Dev Fabric for compute connect to cloud hosted storage.Finally, move compute to the cloud.Finally, move compute to the cloud.

Page 7: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

Windows Azure Storage AbstractionsWindows Azure Storage Abstractions

Page 8: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

Windows Azure Storage AccountWindows Azure Storage Account

Page 9: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

Blob Storage ConceptsBlob Storage Concepts

BlobContainerAccount

cohowinerycohowinery

imagesimages

PIC01.JPGPIC01.JPG

PIC02.JPGPIC02.JPG

videosvideos VID1.AVIVID1.AVI

http://<account>.blob.core.windows.net/<container>/<blobname>http://<account>.blob.core.windows.net/<container>/<blobname>

Page 10: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

Blob Features and FunctionsBlob Features and Functions

Page 11: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

Blob Client LibraryBlob Client LibraryCloudStorageAccount account = CloudStorageAccount.FromConfigurationSetting("CloudStorageAccount");CloudBlobClient blobClient = new CloudBlobClient(

account.BlobEndpoint, account.Credentials); // Create ContainerCloudBlobContainer cloudContainer = blobClient.GetContainerReference(containerName);bool hasCreated = cloudContainer.CreateIfNotExist();

// Access Blob in the ContainerCloudBlob cloudBlob = cloudContainer.GetBlobReference(blobName);

//BlobRequestOptions has retry policy, timeout etc.BlobRequestOptions options = new BlobRequestOptions(); //Upload the local file to Blob servicecloudBlob.UploadFile(uploadFileName, options);

//Download to local file namecloudBlob.DownloadToFile(downloadFileName, options);

Page 12: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

Two types of Blobs under the hoodTwo types of Blobs under the hood

Page 13: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

Block BlobBlock BlobStreaming Workload w/ Random Reads + Committed Streaming Workload w/ Random Reads + Committed WritesWrites

10 GB Movie10 GB Movie

Windows Azure

Storage

Windows Azure

Storage

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.wmvblob.wmvblob.wmv

Page 14: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

Page Blob – Random Read/WritePage Blob – Random Read/Write

10 GB

10 GB

Address S

pace10 G

B A

ddress Space

512

1024

1536

2048

2560

Page 15: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

Windows Azure Content Delivery NetworkWindows Azure Content Delivery Network

Page 16: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

Blobs TipsBlobs Tips

Page 17: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

Windows Azure DriveWindows Azure Drive

Page 18: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

Windows Azure Drives CapabilitiesWindows Azure Drives Capabilities

Page 19: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

Cloud Library SampleCloud Library Sample//Create Local Storage resource and initialize the local cache for drivesCloudDrive.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 systemstring pathOnLocalFS = drive.Mount(cacheSizeInMB, DriveMountOptions.None);

//Use NTFS APIs to Read/Write files to drive…

//Snapshot drive while mounted to create backupsUri snapshotUri = drive.Snapshot();

//Unmount the drivedrive.Unmount();

Page 20: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

Windows Azure TablesWindows Azure Tables

Page 21: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

Table Storage ConceptsTable Storage Concepts

EntityTableAccount

cohowinery

customers

Name =…

Email = …

Name =…

Email = …

winephotos

Photo ID =…

Date =…

Photo ID =…

Date =…

Page 22: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

Entity PropertiesEntity Properties

Page 23: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

PartitionKey and PartitionsPartitionKey and Partitions

Page 24: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

Purpose of the Partition KeyPurpose of the Partition Key

Page 25: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

PartitionKey(Category)

RowKey(Title)

Timestamp ReleaseDate

Action Fast & Furious … 2009

Action The Bourne Ultimatum … 2007

… … … …

Animation Open Season 2 … 2009

Animation The Ant Bully … 2006

PartitionKey(Category)

RowKey(Title)

Timestamp ReleaseDate

Comedy Office Space … 1999

… … … …

SciFi X-Men Origins: Wolverine … 2009

… … … …

War Defiance … 2008

PartitionKey(Category)

RowKey(Title)

Timestamp ReleaseDate

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 Partitions and Partition RangesRanges

Server BTable = Movies

[Comedy - MaxKey)

Server ATable = Movies

[MinKey - Comedy)

Server ATable = Movies

Page 26: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

Table OperationsTable Operations

Page 27: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

Hello Azure ArchitectureHello Azure ArchitectureHello Azure ArchitectureHello Azure Architecture

Cloud

Hello Azure Web App

TwitterAggragator

Web Role

Web Role

Twitter

Aggregator Instance 1

Client Client

Client

Aggregator Instance 0

TwitterDispathcer

Dispatcher Instance 0

Dispatcher Instance 1

Table Storage

Queue

Page 28: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

DEMODEMODEMODEMO

Twitter Table

Page 29: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

Table TipsTable Tips

Page 30: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

Table Tips – cont.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

Page 31: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

Queue Storage ConceptsQueue Storage Concepts

MessageQueueAccount

order processing

customer ID order ID http://…

customer ID order ID http://…

cohowinery

Page 32: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

Loosely Coupled interaction with QueuesLoosely Coupled interaction with Queues

Azure Queue

Input Queue (Work Items)

Page 33: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

Queue’s Reliable DeliveryQueue’s Reliable Delivery Azure QueueInput Queue (Work Items)

Page 34: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

DEMODEMODEMODEMO

Twitter Queue

Page 35: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.

Queue TipsQueue Tips

Page 36: MSDN Event. WINDOWS AZURE STORAGE Windows Azure Storage Storage in the Cloud –Scalable, durable, and available –Anywhere at anytime access –Only pay.