• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Windows Azure Drive
 

Windows Azure Drive

on

  • 314 views

 

Statistics

Views

Total Views
314
Views on SlideShare
311
Embed Views
3

Actions

Likes
0
Downloads
3
Comments
0

1 Embed 3

https://kb.epam.com 3

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Windows Azure Drive Windows Azure Drive Presentation Transcript

    • Windows Azure Drive Pavlo Revenkov EPAM Cloud Computing Competency Center Email: pavlo_revenkov@epam.com Skype: rp_risingstar Habrahabr: habrahabr.ru/users/risingstar/
    • Data management services 2 Web-role Worker-role Worker-role Worker-role Web-role Drive SQL Azure Blobs Tables Queues
    • Example: CMS 3 Publishers Instance 1 Author Instance 2 Instance 3 Mount 30 minutes Snapshot Repository Instance 4
    • Windows Azure Drive 4 Subscription Storage Account (100 ТВ) Storage Account (100 ТВ) Container Block Blob (200 GB) Container Page Blob (1 ТВ) Storage Account (100 ТВ) Storage Account (100 ТВ) … Container … Azure Drive (1 ТВ) …
    • Blob content upload var storageAccount = CloudStorageAccount.Parse( ConfigurationManager .ConnectionStrings[ConnectionStringSetting] .ConnectionString); var blobClient = storageAccount.CreateCloudBlobClient(); var container = blobClient.GetContainerReference(containerName); var pageBlob = container.GetPageBlobReference(blobName); using (var fileStream = new FileStream(filePath, FileMode.Open)) { pageBlob.Create(fileStream.Length); var buffer = new byte[partSize]; while (offset < fileStream.Length) { var bytesRead = fileStream.Read(buffer, 0, partSize); pageBlob.WritePages(new MemoryStream(buffer, 0, bytesRead), offset); offset += bytesRead; } } 5
    • 1. public static void UploadVHDFile(string filePath, string containerName, string blobName) 2. { 3. const int partSize = 1024 * 1024; 4. 5. var storageAccount = CloudStorageAccount.Parse( 6. ConfigurationManager.ConnectionStrings[ConnectionStringSetting].ConnectionString); 7. 8. var blobClient = storageAccount.CreateCloudBlobClient(); 9. var container = blobClient.GetContainerReference(containerName); 10. container.CreateIfNotExist(); 11. 12. var pageBlob = container.GetPageBlobReference(blobName); 13. pageBlob.DeleteIfExists(); 14. pageBlob.Properties.ContentType = "binary/octet-stream"; 15. 16. using (var fileStream = new FileStream(filePath, FileMode.Open)) 17. { 18. int offset = 0; 19. 20. pageBlob.Create(fileStream.Length); 21. 22. var buffer = new byte[partSize]; 23. while (offset < fileStream.Length) 24. { 25. var bytesRead = fileStream.Read(buffer, 0, partSize); 26. 27. pageBlob.WritePages(new MemoryStream(buffer, 0, bytesRead), offset); 28. 29. offset += bytesRead; 30. 31. Console.Write('.'); 32. } 33. } 34. } 6
    • Modes 7 CloudDrive client Snapshot URL Mount Exception Mount Yes Author Lease mode Snapshot mode read write read Windows Azure Drive Publisher
    • Workflow var account = CloudStorageAccount.Parse( ConfigurationManager.AppSettings["ConnectionString“]); var drive = new CloudDrive(blobUri, account.Credentials.*); try { drive.Mount(0, DriveMountOptions.None); ... } catch (CloudDriveException e) { drive = new CloudDrive(new Uri(drive.Snapshot().AbsoluteUri), ...); drive.Mount(0, DriveMountOptions.None); } finally { drive.Unmount(); } 8
    • Demo 9
    • References Differences Between the Storage Emulator and Windows Azure Storage Services  http://msdn.microsoft.com/en-us/gg433135 Windows Azure Drive whitepaper  http://go.microsoft.com/?linkid=9710117 10
    • Questions? 11