Presentation is loading. Please wait.

Presentation is loading. Please wait.

Jai Haridas Software Engineer Microsoft Corporation SESSION CODE: COS310.

Similar presentations


Presentation on theme: "Jai Haridas Software Engineer Microsoft Corporation SESSION CODE: COS310."— Presentation transcript:

1 Jai Haridas Software Engineer Microsoft Corporation SESSION CODE: COS310

2

3

4

5

6 BlobContainerAccount cohowinery images PIC01.JPG PIC02.JPG videos VID1.AVI http://.blob.core.windows.net/ /

7

8 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);

9

10 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

11 0 10 GB 10 GB Address Space 512 1024 1536 2048 2560

12

13

14 st=2009-11-07T08:49Z &se=2009-11-07T09:49Z &si=foo &sr=c &sp=rw &sig=3OSeIHP8haK%2fle9%2bBK3BX1DsdMM%3d

15

16

17

18

19

20 Windows Azure Blob Service Application Lease Drive X:

21 //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();

22

23

24

25 EntityTableAccount cohowinery customers Name =… Email = … Name =… Email = … winephotos Photo ID =… Date =… Photo ID =… Date =…

26

27

28

29 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

30

31 [DataServiceKey("PartitionKey", "RowKey")] public class Movie { /// Movie Category is the partition key public string PartitionKey { get; set; } /// Movie Title is the row key public string RowKey { get; set; } public DateTime Timestamp { get; set; } public int ReleaseYear { get; set; } public double Rating { get; set; } public string Language { get; set; } public bool Favorite { get; set; } }

32 CloudStorageAccount account = CloudStorageAccount.FromConfigurationSetting("CloudStorageAccount"); CloudTableClient tableClient = new CloudTableClient( account.TableEndpoint, account.Credentials); // Create Movie Table string tableName = Movies; tableClient.CreateTableIfNotExist(tableName); TableServiceContext context = tableClient.GetDataServiceContext(); // Add movie context.AddObject(tableName, new Movie("Action", White Water Rapids Survival")); context.SaveChangesWithRetries(); // Query movie var q = (from movie in context.CreateQuery (tableName) where movie.PartitionKey == "Action" && movie.Rating > 4.0 select movie).AsTableServiceQuery (); foreach (Movie movieToUpdate in q) { movieToUpdate.Favorite = true; context.UpdateObject(movieToUpdate); } context.SaveChangesWithRetries( ); SaveChangesOptions.Batch

33

34

35

36

37 MessageQueueAccount order processing customer ID order ID http://… cohowinery

38 Azure Queue Input Queue (Work Items)

39 Azure Queue Input Queue (Work Items)

40 CloudStorageAccount account = CloudStorageAccount.FromConfigurationSetting("CloudStorageAccount"); CloudQueueClient queueClient = new CloudQueueClient( account.QueueEndpoint, account.Credentials); //Create Queue CloudQueue queue = queueClient.GetQueueReference(queueName); queue.CreateIfNotExist(); //Add Message CloudQueueMessage message = new CloudQueueMessage(some content"); queue.AddMessage(message); //Get Message message = queue.GetMessage(TimeSpan.FromMinutes(3) /*Invisibility timeout*/); // Process Message within the Invisibility Timeout //Delete Message queue.DeleteMessage(message);

41

42

43

44

45

46

47 Content (Blob Storage) Image Processor (Queue) Image Processor (Worker Role) Content Ingestion Services 1 2 3

48

49 www.microsoft.com/teched www.microsoft.com/learning http://microsoft.com/technet http://microsoft.com/msdn

50

51 Sign up for Tech·Ed 2011 and save $500 starting June 8 – June 31 st http://northamerica.msteched.com/registration You can also register at the North America 2011 kiosk located at registration Join us in Atlanta next year

52

53


Download ppt "Jai Haridas Software Engineer Microsoft Corporation SESSION CODE: COS310."

Similar presentations


Ads by Google