Presentation is loading. Please wait.

Presentation is loading. Please wait.

Migration of Real Product into Windows Azure Lessons Learned.

Similar presentations


Presentation on theme: "Migration of Real Product into Windows Azure Lessons Learned."— Presentation transcript:

1

2 Migration of Real Product into Windows Azure Lessons Learned

3 Agenda 1.Solution Architecture Concept 2.Think as Azure Developer 3.Minimize Latency 4.Master Windows Azure SQL Database 5.Entity Framework with Windows Azure SQL Database 6.Cloud Services - Tips and Tricks 7.Best approaches for Windows Azure Diagnostics, Logging and Monitoring 8.Summary

4 Solution Architecture Concept Customer N Customer 1 Compute Storage / SQL Azure Data Layer Application Layer Integration Layer Client Layer (on-premise) Desktop Clients Connect Caching Tables Traffic Manager Access Control Cloud Service 1 Data Sync Database Reporting Embedded Clients Desktop Clients Embedded Clients Messaging Cloud Service N

5 Needs in Technologies / Components

6 Think as Azure Developer! The three most important areas to master in order to design your application to run at the appropriate scale, performance, and for the best costs

7 Think as Azure Developer – Minimize Latency Response Time = 2 x (Internet Latency + DC Latency) + App Logic Exec Time + DB Query Exec Time Internet Latency Storage / SQL Azure Web/Worker Roles LB Data Center Latency

8 Think as Azure Developer – Minimize Latency Response Time = 2 x (Internet Latency + DC Latency) + App Logic Exec Time + DB Query Exec Time

9 Think as Azure Developer – Minimize Latency To Minimize Internet Latency  Select a data center closest to majority of your users  Use CDN  Combine round-trips from the client application to reduce any physical network overhead associated between tiers To Minimize Data Center Latency  Use Cache where applicable  Combine round-trips from services to Data Storage

10 Master Windows Azure SQL Database Scale it out  Use several separate Azure SQL Databases  Use Federations  Consider using NoSQL storage for plain data  Use multiple subscriptions Minimize number of round-trips  Use local or Azure Cache when possible  Replace Ad-hoc queries with Stored Procedures  Batch up queries  Use Bulk loading instead of individual inserts

11 Master Windows Azure SQL Database Expect some operations need to be retried (e.g. due to transient faults, throttling, etc.)  Avoid long-running queries / split operations into smaller chunks  Make your operations easily restartable Determine how much you can stress test your database before getting throttled  Reduce number of application level connections  Scale out data model adding more databases

12 Master Windows Azure SQL Database Follow traditional best-practices for Data Access Layer  Retrieve only data that you need  Keep transactions as short as possible  Open the connection late and close it ASAP Examine execution plan for each “slow” query, and search areas for improvement Examine Database object schemas and constraints

13 Entity Framework with Windows Azure SQL Database Eager Loading using (var context = new AdventureWorksDWEntities()) { var query = contect.Customers.Include(“InternetSales”).Where(c => c.InternetSales.Any()).Take(100); var customers = query.ToList(); EnumerateCustomers(); } Lazy Loading using (var context = new AdventureWorksDWEntities()) { var query = contect.Customers.Where(c => c.InternetSales.Any()).Take(100); var customers = query.ToList(); EnumerateCustomers(); }

14 Entity Framework with Windows Azure SQL Database Figure 1 Comparing Eager Loading to Lazy Loading from a Local Database Figure 2 Comparing Eager Loading to Lazy Loading from SQL Azure

15 Cloud Services – Best Practices Explicit design to scale-out, NOT scale-up Do not store state on individual instances (“make everything stateless”) Do not assume subsequent requests will hit the same instance Prefer asynchronous calls Design for availability Avoid single point of component failure (multiple web/worker instances, spread across multiple fault/upgrade domains) Fall back to multiple components to mitigate the impact of a specific service being offline / unavailable

16 Cloud Services – Best Practices Handle failure gracefully  For transient failures, provide appropriate retry mechanisms to reconnect or resubmit work  For other failure events, provide rich instrumentation on the failure event and a suitable error message back to the user.  Fall back to a different service or workflow where possible Isolate services and client APIs behind generic interfaces allow for replacement or side-by-side evaluation

17 Cloud Services – Optimize Communication Use REST-full services if possible Simpler code paths and easier expose data Use more efficient JSON or binary serialization frameworks Serialization/Deserialization hugely impactful on throughput and latency Use network friendly data transfer objects (DTOs) Do NOT mix data/state and logic in DTOs Avoid dependencies (if you cannot easily serialize a DTO class, you have a bad design) Use asynchronous communication Minimize blocking IIS dispatch pipeline

18 Classic 1:1 Migration into Azure What is wrong with this? SQL Azure Web Roles LB

19 “Smart” Migration into Azure Scale storage Decouple receiving work from executing work Scale work tasks via queues SQL Azure / Storage Web Roles LB Worker Roles

20 Windows Azure Telemetry & Diagnostics Collect  Tune infrastructure performance counters and system events  Instrument application logging Analyze  Grab real-time and historical event logs  Aggregate/Filter required data Consume  Make well-considered correction actions  Publish analytics in a consumable format

21 Windows Azure Diagnostics – Internal View

22 Windows Azure Diagnostic Tips Do not rely on Default Diagnostic Monitor configuration Remove unused and add required performance counters / logs Apply appropriate log level filters Set appropriate scheduled transfer periods (5 – 15 minutes) Use dedicated storage account for diagnostics data

23 Windows Azure Logging Tips Optimize custom application logging  Log all API calls with context, method, unique identifiers of operation, timestamps (latency) and result  Use common logging libraries (e.g. log4net, Nlog)  Use Custom Data Source in Diagnostic Monitor to copy files periodically to blob storage

24 Summary Be a pro Azure Developer:  Think about performance and latency!  Think about operational costs!  Think about proper logging and monitoring of your solution!

25 Questions Time Thank you for your time! Questions?

26 Заповни Анкету Виграй Приз http://anketa.msswit.in.ua

27 Migration of Real Product into Windows Azure Lessons Learned By Oleksii Syrotenko Development Team Leader, EPAM Systems E-mail: oleksii_syrotenko@epam.comoleksii_syrotenko@epam.com Skype: oleksii.syrotenko

28


Download ppt "Migration of Real Product into Windows Azure Lessons Learned."

Similar presentations


Ads by Google