* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Document
Microsoft Access wikipedia , lookup
Oracle Database wikipedia , lookup
Entity–attribute–value model wikipedia , lookup
Concurrency control wikipedia , lookup
Extensible Storage Engine wikipedia , lookup
Functional Database Model wikipedia , lookup
Microsoft Jet Database Engine wikipedia , lookup
Microsoft SQL Server wikipedia , lookup
Open Database Connectivity wikipedia , lookup
Relational model wikipedia , lookup
Migration of Real Product into Windows Azure Lessons Learned Agenda 1. 2. 3. 4. 5. Solution Architecture Concept Think as Azure Developer Minimize Latency Master Windows Azure SQL Database 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 Customer 1 Desktop Clients Data Layer Application Layer Integration Layer Client Layer (on-premise) Solution Architecture Concept Embedded Clients Traffic Manager Reporting Storage / SQL Azure Compute Customer N Connect Access Control Messaging Cloud Service 1 Database Desktop Clients Tables Cloud Service N Caching Embedded Clients Data Sync Needs in Technologies / Components 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 Think as Azure Developer – Minimize Latency Response Time = 2 x (Internet Latency + DC Latency) + App Logic Exec Time + DB Query Exec Time Web/Worker Roles Storage / SQL Azure Think as Azure Developer – Minimize Latency Response Time = 2 x (Internet Latency + DC Latency) + App Logic Exec Time + DB Query Exec Time 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 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 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 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 Entity Framework with Windows Azure SQL Database Lazy Loading using (var context = new AdventureWorksDWEntities()) { var query = contect.Customers.Where(c => c.InternetSales.Any()).Take(100); var customers = query.ToList(); EnumerateCustomers(); } 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(); } 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 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 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 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 Classic 1:1 Migration into Azure • What is wrong with this? Web Roles SQL Azure “Smart” Migration into Azure • Scale storage • Decouple receiving work from executing work • Scale work tasks via queues Web Roles Worker Roles SQL Azure / Storage 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 Windows Azure Diagnostics – Internal View 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 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 Summary • Be a pro Azure Developer: Think about performance and latency! Think about operational costs! Think about proper logging and monitoring of your solution! Questions Time Thank you for your time! Questions? Заповни Анкету Виграй Приз http://anketa.msswit.in.ua Migration of Real Product into Windows Azure Lessons Learned By Oleksii Syrotenko Development Team Leader, EPAM Systems E-mail: [email protected] Skype: oleksii.syrotenko