Building Scalable Web Apps with Windows Azure.pptx
Building Scalable Web Apps with Windows Azure Name Title Microsoft Corporation Agenda Who will benefit from this talk Web app developers who are already familiar with Windows Azure with scaling needs Topics Asynchronous patterns & techniques Managing data access Tuning application performance What you’ll leave with Windows Azure helps you build scalable web apps using the approaches that you’re already familiar with Synchronous Design Pattern Each thread dedicated to one outstanding request Block on each step of “the work” done for each request, then respond & repeat This approach scales poorly Each outstanding request is stored on a thread stack Threads block even when there is work to be done Adding a thread enables only one additional concurrent request Client Request #1 Web App Front End SQL Azure WA Storage Middle Tier Client Response #1 Client Request #2 “The Work”#1 Response #1 Time passes… Thread Thread Waiting… blocks Asynchronous Design Pattern Each thread picks up work whenever it is ready A thread handling one request may handle another before the first pletes Client Request #1 Web App Front End SQL Azure WA Storage Middle Tier Client Response #1 Client Request #2 “The Work”#1 Response #1 Thread Thread Client Response #2 “The Work”#2 Response #2 Context This approach scales well Client requests tracked explicitly in app’s data structures Threads never block while there is work to be done Each thread can handle possibly many concurrent requests But bookkeeping & synchronization can be difficult… Async/await support simplifies bookkeeping void UploadImage(Stream image, CloudBlob destBlob) { // Add image to list in SQL Azure AddImageToSQLAzure(); // Upload image to blob storage UploadImageToBlob(image, destBlob); } async Task UploadImageAsync(Stream image, CloudBlob destBlob) { // Add image to list in SQL Azure var t1 = AddImageToSQLAzureAsync(); // Upload image to blob storage var t2 = Up
Building Scalable Web Apps with Windows Azure 来自淘豆网www.taodocs.com转载请标明出处.