Presentation is loading. Please wait.

Presentation is loading. Please wait.

Udvikling med Windows Azure Nikolaj Winnes

Similar presentations


Presentation on theme: "Udvikling med Windows Azure Nikolaj Winnes"— Presentation transcript:

1 Udvikling med Windows Azure Nikolaj Winnes nikolaj@legayo.dk

2 Udvikling med Windows Azure Cloud Computing er et af tidens allerstørste buzzwords. Leverandører bruger udtrykket til at promovere alt fra webhosting til miljøer med global tilgængelighed og always-on. Hvad er facts og hvad er fup, og hvordan kan vi som udviklere bygge løsninger der får fordel af denne nye verden. I oktober 2008 løftede Microsoft sløret for deres Cloud Computing vision. Helt centralt i denne vision står Windows Azure, et operativ system til skyen. I denne session vil vi kigge på de muligheder og begrænsninger du har som udvikler med Windows Azure. Vi viser hvordan du kommer i gang med udvikling på Windows Azure. Sessionen vil dække de forskellige udviklingsfaser: analyse, design, udvikling, test og udrulning af en Windows Azure applikation.

3

4 Hvad er cloud computing ? IaaS (Infrastructure) Virtual servers PaaS (Platform) IDE Database CDN SDK/Services Deployment Management Saas (Software) Applikationer

5 Udbydere PaaSIaaSSaaS Amazon Microsoft Salesforce Google

6 Azure platformen

7 Getting started Signing up Visual Studio support SDK Project types Development Fabric Debugging locally Logging in the cloud

8 I begyndelsen var... Portalen Sådan kommer du igang

9 Web Web Roles WebForms ASP.NET MVC

10 HELLO AZURE! demo

11 Storage Tables Blobs Queues SQL Data Services

12

13 Blob blob.mov azure.pdf sql.pdf Blob Storage ContainerAccount library e-books screencasts

14 Storage Account And Blob Containers Storage Account – An account can have many Blob Containers Container – A container is a set of blobs – Sharing policies are set at the container level Public READ or Private – Associate Metadata with Container Metadata is pairs Up to 8KB per container – List the blobs in a container BlobContainerAccount sally pictures IMG001.JPG IMG002.JPG movies MOV1.AVI

15 Blob Namespace Blob URL http://.blob.core.windows.net/ / Example: Account – sally Container – music BlobName – rock/rush/xanadu.mp3 URL: http://sally.blob.core.windows.net/music/rock/rush/xanadu.mp3 http://sally.blob.core.windows.net/music/rock/rush/xanadu.mp3 Blob Container Account sally pictures IMG001.JPG IMG002.JPG movies MOV1.AVI

16 Blob Features And Functions Store Large Objects (up to 50 GB each) Standard REST PUT/GET Interface http://.blob.core.windows.net/ / – PutBlob Inserts a new blob or overwrites the existing blob – GetBlob Get whole blob or by starting offset, length – DeleteBlob – Support for Continuation on Upload Associate Metadata with Blob – Metadata is pairs – Set/Get with or separate from blob data bits – Up to 8KB per blob

17 Continuation On Upload Scenario Want to upload a large 10 GB file into the cloud If upload fails in the middle, need an efficient way to resume the upload from where it failed (rather than starting over)

18 Uploading A Blob Via Blocks Uploading a Large Blob 10 GB Movie Windows Azure Storage Block Id 1 Block Id 2 Block Id 3 Block Id N blobName = “TheBlob.wmv”; PutBlock(blobName, blockId1, block1Bits); PutBlock(blobName, blockId2, block2Bits); ………… PutBlock(blobName, blockIdN, blockNBits); PutBlockList(blobName, blockId1,…,blockIdN); blobName = “TheBlob.wmv”; PutBlock(blobName, blockId1, block1Bits); PutBlock(blobName, blockId2, block2Bits); ………… PutBlock(blobName, blockIdN, blockNBits); PutBlockList(blobName, blockId1,…,blockIdN); TheBlob.wmv Benefit: Efficient continuation and retry Parallel and out of order upload of blocks

19 PutBlockList Example Block Id 1Block Id 3Block Id 2 BlobName = ExampleBlob.wmv Block Id 4 Block Id 2Block Id 3 Block Id 4 Example Uploading Blocks Out of Order Same Block IDs Unused Blocks Sequence of Operations – PutBlock(BlockId1) – PutBlock(BlockId3) – PutBlock(BlockId4) – PutBlock(BlockId2) – PutBlock(BlockId4) – PutBlockList(BlockId2, BlockId3, BlockId4)

20 Blob As A List Of Blocks Blob – Consists of a List of Blocks Properties of Blocks – Each Block defined by a Block ID Up to 64 Bytes, scoped by Blob Name – Blocks are immutable – A block is up to 4MB Do not have to be same size

21 BlockList Operations PutBlockList for a Blob – Provide the list of blocks to comprise the readable version of the blob – If multiple blocks are uploaded with same Block ID – Last committed block wins – Blocks not used will be garbage collected GetBlockList for a Blob – Returns the list of blocks that represent the readable (committed) version of the blob Block ID and Size of Block is returned for each block

22 REST PutBlock PUT http://dvd.blob.core.windows.net/movies/TheBlob.wmv ?comp=block &blockid=BlockId1 &timeout=60 HTTP/1.1 Content-Length: 4194304 Content-MD5: HUXZLQLMuI/KZ5KDcJPcOA== Authorization: SharedKey dvd: F5a+dUDvef+PfMb4T8Rc2jHcwfK58KecSZY+l2naIao= x-ms-date: Mon, 27 Oct 2008 17:00:25 GMT ……… Block Data Contents ……… AccountContainer Blob Name

23 REST PutBlockList PUT http://dvd.blob.core.windows.net/movies/TheBlob.wmv ?comp=blocklist &timeout=120 HTTP/1.1 Content-Length: 161213 Authorization: SharedKey dvd: QrmowAF72IsFEs0GaNCtRU143JpkflIgRTcOdKZaYxw= x-ms-date: Mon, 27 Oct 2008 17:00:25 GMT BlockId1 BlockId2 ……………… AccountContainer Blob Name

24 REST GetBlob GET http://dvd.blob.core.windows.net/movies/TheBlob.wmv HTTP/1.1 Authorization: SharedKey dvd: RGllHMtzKMi4y/nedSk5Vn74IU6/fRMwiPsL+uYSDjY= X-ms-date: Mon, 27 Oct 2008 17:00:25 GMT Get whole blob GET http://dvd.blob.core.windows.net/movies/TheBlob.wmv ?timeout=60 HTTP/1.1 Range: bytes=1024000-2048000 Get a range of the blob

25 Blob Enumeration – Delimiter Enumerates the list of blobs in a container – Hierarchical listing: prefix + delimiter – Continuation: NextMarker + Marker Container “movies” has: Action/Rocky.avi Action/Rocky2.avi Drama/Crime/GodFather.avi Drama/Crime/GodFather2.avi Drama/LordOfRings.avi Thriller/TheBlob.wmv List top level “directories” REST Request: GET http://dvd.blob.windows.net/movies ?comp=list &delimiter=/ Results: Action Drama Horror Container “movies” has: Action/Rocky1.wmv Action/Rocky2.wmv Action/Rocky3.wmv Action/Rocky4.wmv Action/Rocky5.wmv Drama/Crime/GodFather1.wmv Drama/Crime/GodFather2.wmv Drama/Memento.wmv Horror/TheBlob.wmv

26 Blob Enumeration – Prefix Enumerates the list of blobs in a container – Hierarchical listing: prefix + delimiter – Continuation: NextMarker + Marker Container “movies” has: Action/Rocky1.avi Action/Rocky2.avi ……… Action/Rocky5.avi Drama/Crime/GodFather1.avi Drama/Crime/GodFather2.avi Drama/Gladiator.avi Horror/TheBlob.wmv List directory “Drama”: REST Request: GET http://dvd.blob.windows.net/movies ?comp=list &prefix=Drama/ &delimiter=/ Results: Drama/Crime Drama/Memento.wmv Container “movies” has: Action/Rocky1.wmv Action/Rocky2.wmv Action/Rocky3.wmv Action/Rocky4.wmv Action/Rocky5.wmv Drama/Crime/GodFather1.wmv Drama/Crime/GodFather2.wmv Drama/Memento.wmv Horror/TheBlob.wmv

27 Container “movies” has: Action/Rocky1.wmv Action/Rocky2.wmv Action/Rocky3.wmv Action/Rocky4.wmv Action/Rocky5.wmv Drama/Crime/GodFather1.wmv Drama/Crime/GodFather2.wmv Drama/Memento.wmv Horror/TheBlob.wmv Blob Enumeration – MaxResults Enumerates the list of blobs in a container – Hierarchical listing: prefix + delimiter – Continuation: NextMarker + Marker Max Results and Next Marker REST Request: GET http://dvd.blob.windows.net/movies ?comp=list &prefix=Action &maxresults=3 Results: Action/Rocky1.wmv Action/Rocky2.wmv Action/Rocky3.wmv OpaqueMarker1

28 Blob Enumeration – Continuation Enumerates the list of blobs in a container – Hierarchical listing: prefix + delimiter – Continuation: NextMarker + Marker Using Continuation Marker REST Request: GET http://dvd.blob.windows.net/movies ?comp=list &prefix=Action &maxresults=3 &marker=OpaqueMarker1 Results: Action/Rocky4.wmv Action/Rocky5.wmv Container “movies” has: Action/Rocky1.wmv Action/Rocky2.wmv Action/Rocky3.wmv Action/Rocky4.wmv Action/Rocky5.wmv Drama/Crime/GodFather1.wmv Drama/Crime/GodFather2.wmv Drama/Memento.wmv Horror/TheBlob.wmv

29 Summary Of Windows Azure Blobs Easy to use REST Put/Get/Delete interface Can read from any Offset, Length of Blob Conditional Put and Get Blob Max Blob size – 50 GB using PutBlock and PutBlockList – 64 MB using PutBlob Blocks provide continuation for blob upload Put Blob/BlockList == Replace Blob for CTP – Can replace an existing blob with new blob/blocks

30 BLOB STORAGE DEMO

31 Table storage

32 Data Model Table – A Storage Account can create many tables – Table name is scoped by Account Data is stored in Tables – A Table is a set of Entities (rows) – An Entity is a set of Properties (columns) Entity – Two “key” properties that together are the unique ID of the entity PartitionKey – enables scalability RowKey – uniquely identifies the entity within the partition

33 Table Partition – all entities in table with same partition key value Application controls granularity of partition Partitioning Partition Key Document Row Key Version Property 3 ChangedOn Property 4 Description Examples DocV1.08/2/2007Committed version Examples DocV2.0.19/28/2007 Alice’s working version FAQ DocV1.05/2/2007Committed version FAQ DocV1.0.17/6/2007 Alice’s working version FAQ DocV1.0.28/1/2007 Sally’s working version Partition 1 Partition 2

34 Partitioning Guidelines Performance – Use a PartitionKey that is common in your queries Entities with same partition key value are clustered Scalability – We monitor partition traffic – Automatically load balance partitions Each partition can potentially be served by a different storage node Scale to meet the traffic needs of your application – More partitions – makes it easier to balance load

35 Partition Key Document Row Key Version Property 3 ChangedOn Property 4 Description Examples DocV1.08/2/2007Committed version Examples DocV2.0.19/28/2007 Alice’s working version FAQ DocV1.05/2/2007Committed version FAQ DocV1.0.17/6/2007 Alice’s working version FAQ DocV1.0.28/1/2007 Sally’s working version Partition 1 Partition 2 Getting all versions of FAQ is fast – Access single partition Get all documents before 5/30/2008 takes longer – Have to traverse all partitions Entity Locality

36 Entities and Properties Each Entity can have up to 255 properties Every Entity has fixed key properties – Partition key – Row key No fixed schema for rest of properties – 2 entities in the same table can have different properties – Properties stored as pairs Each entity has a system maintained version

37 USING AZURE TABLE STORAGE demo

38

39 Web + Worker Queue Example Cloud Storage (blob, table, queue) Web Role LB n Worker Role m

40 Windows Azure Queues Provide reliable message delivery – Simple, asynchronous work dispatch – Programming semantics ensure that a message can be processed at least once Queues are Highly Available, Durable and Performance Efficient Access is provided via REST

41 Account, Queues And Messages An Account can create many Queues – Queue Name is scoped by the Account A Queue contains Messages – No limit on number of messages stored in a Queue But a Message is stored for at most a week http://.queue.core.windows.net/ Messages – Message Size <= 8 KB – To store larger data, store data in blob/entity storage, and the blob/entity name in the message

42 Queue Programming API Queues – Create/Clear/Delete Queues – Inspect Queue Length Messages – Enqueue (QueueName, Message) – Dequeue (QueueName, Invisibility Time T) Returns the Message with a MessageID Makes the Message Invisible for Time T – Delete(QueueName, MessageID)

43 2 2 1 1 C1C1 C1C1 C2C2 C2C2 Dequeue And Delete Messages 1 1 2 2 3 3 4 4 Producers Consumers P2P2 P2P2 P1P1 P1P1 3 3 2. Dequeue(Q, 30 sec)  msg 2 1. Dequeue(Q, 30 sec)  msg 1 1 1 2 2

44 C1C1 C 1 C2C2 C2C2 Dequeue And Delete Messages 3 4 4 Producers Consumers P2P2 P2P2 P1P1 P1P1 1 1 2 2 2. Dequeue(Q, 30 sec)  msg 2 3. C2 consumed msg 2 4. Delete(Q, msg 2) 7. Dequeue(Q, 30 sec)  msg 1 1. Dequeue(Q, 30 sec)  msg 1 5. C 1 crashed 1 1 2 2 1 1 6. msg1 visible 30 seconds after Dequeue Benefit: Insures that every message can be processed at least once 3 3

45 Summary Of Windows Azure Queues Provide reliable message delivery – Allows Messages to be retrieved and processed at least once No limit on number of messages stored in a Queue Message size is <=8KB

46 Logic Worker roles Queues Workflow services Service Bus

47 WORK, WORK, WORK demo

48 .NET Services Workflow Service Bus Access Control

49 SQL Data Services “ SQL Data Services, with TDS support, will be available as a public CTP in mid calendar year 2009 and commercially available in the second half of calendar year 2009. ” http://blogs.technet.com/dataplatforminsider http://blogs.technet.com/dataplatforminsider 10.marts 2009

50 Live Services

51 Deployment TildelingKopieringKonfigurationStart Load balancering

52 Deployment Windows Azure automates a lot of tasks for you, including initial deployment of your application. I thought I’d take a moment to describe at a high level what’s happening behind the scenes during that initial deployment and starting of an application. Allocation – The Fabric Controller looks at the inventory in the data center and finds VMs within servers that fit all the requirements of your application. One of those requirements is that resources are allocated across fault domains. As an example, a specific rack in the data center might be a fault domain. The Fabric Controller ensures that the hardware running your application isn’t all on one rack, so that if an entire rack goes down, your application stays up. Place role bits on nodes – The next step is to deploy the bits for your application’s roles (e.g. web role and worker role) onto the individual virtual machines that were allocated in step 1. If there’s been a recent update to the OS image, it’s possible at this point that a new OS image needs to first be copied to the machine and booted. Configuration settings – The next step is to apply any application-specific configuration settings that affect the setup of the virtual machine (like IIS settings). Start roles – Now we’re ready to actually start roles. For web roles, this means turning your web application on in IIS. For worker roles, this means invoking your role binary. Configure load balancers – If your application includes a web role, the next step is to configure the load balancer to route traffic to your web role. At this point your application is running. If you’re interested in more detail about how these steps happen in the data center (and a lot more), I highly recommend Erick Smith and Chuck Lenzmeier’s PDC session “Under the Hood: Inside the Windows Azure Hosting Environment.”Erick Smith and Chuck Lenzmeier’s PDC session “Under the Hood: Inside the Windows Azure Hosting Environment.”

53

54 Migrating Existing apps Mail CNAME Web Services CAS 3rd Party components

55

56 Fordele  Ingen infrastruktur at vedligeholde  Global tilstedeværelse (snart)  Høj tilgængelighed og stabilitet (nogen gange)  Ubegrænset skalering (næsten)  Du betaler for hvad du bruger (også når du ikke bruger det)

57 Bagdele  Standarder  Lock-in  Arkitektur  Migrering


Download ppt "Udvikling med Windows Azure Nikolaj Winnes"

Similar presentations


Ads by Google