Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Методология и практический опыттестирования быстродействия приложений,сервисов и сайтов с высокой нагрузкой спомощью Visua...
Содержание• Методологии тестированиякачества и нагрузки– пробы и ошибки• От методологии – к практике напримере msn.com– Vi...
Why MSN?• 19 лет online• Траффик главной страницы (www.msn.com) – больше чем 4.3миллиарда просмотров за месяц• Постоянно в...
• What does High Quality mean?• Resilience Quality• Environment Quality• Diagnostics & Monitoring Quality• Configurability...
What does High Quality mean?Quality is not justworking FunctionalityContributors to High Quality
Service Resilience QualityFault ToleranceRecover from Fault conditionsDegrade GracefullyHow to Test? – Fault Injection!“Ch...
Environment Quality• Test Environments in-sync with Production Environment• Design For Roll back• Solid Deployment testing...
Diagnostics & Monitoring Quality• Monitoring Being Proactive Vs. Reactive Lower MTTD [Mean Time to Detect] Lower Downti...
Maintainability• The ease with which the system can be:• Modified to meet new requirements• Modified to make future mainte...
Methodology• Min InstallComponent Level Testing• Cluster Level Testing
Methodology : Minimal Installation• One Box Setup• Build the baseline (expectations)• Tuning for scenarios• See what comes...
Min Install - Performance Load andStress Testing• Identify Production Scenarios (BVTs)– Confirm meeting original expectati...
Methodology : Cluster Level Testing• Integration Testing• Prod simulation (IIS Playback, SQL playback, etc)• Testing new b...
Performance is important• How to improve it?– Measure– Fix– Measure again• How to measure it with VS?– VS Profiler
What is VS Profiler?• Performance measurement tool• Process orientedUltimate Premium Professional Express
Common Performance Issue• High CPU utilization• I/O bottleneck• Tiers interaction• Resource contention, Poor core utilizat...
High CPU utilization• Sampling: statistical form of CPU profiling• Choose Sampling when– CPU is the critical resource– Low...
Sampling Profiling• void Alpha()• {•• Beta();• }• void Beta()• {• }30 samples50 samplesExclusive InclusiveAlphaBeta 50 503...
Sampling Profiling Call Tree
Q&A
I/O bottleneck• Instrumentation: method timing profiling• Choose Instrumentation when– CPU usage is low– Exact function ca...
Instrumentation Profiling• void MyFunction()• {• FUNC_ENTER(MyFunction);• . . .• CALL_ENTER(WriteFile);• // Call another f...
Instrumentation Profiling Call Tree
Managed memory profiling• Allocation data– Allocated type– Allocating call stack• Lifetime data– GC generations
More power to VS Profiler• Data collection– Remote profiling– ETW based collection– Various performance counters– Command ...
VS Profiler - Limitations• Move to ETW in Visual Studio 2012• Windows 8 Limitations with CPU sampling– Tier Interaction Pr...
Тестирование нагрузки в условиях автоматическогоуправления датацентрами
Automatic DC Management• Like a cloud, but with more control• Testing the deployment process• Monitoring
Monitoring• Deployment monitoring– Automated rollbacks• Watchdogs– Simple Watchdogs (disk space, CPU, etc)– User Watchdogs...
Тестирование быстродействия наклиентской части
Что будет рассмотреноTTIPLTTTVPLT2TTGTTLBTTOTTFRTTFBVRTAMSNPIEKeynoteYSlowWebPageTestGomezWebRunnerЧто это за метрики?Как ...
Метрики для оценки производительностиЗапросстраницыСервер посылаетHTML браузеруБраузер парсируетHTML, загружает JS иCSS, с...
Какие метрики производительностинужно использовать?TTLBTime tolast byteTTFBTime tofirst byteTTFRTime tofirst renderTTVTime...
Performance Optimizations• Images loaded optimally in phases• Async script loading• JS execution in multiple phases• Testi...
Optimal Image LoadingDefine and maintain Performance budget– PLT goal permits only 400KB weight at 100% bandwidth efficien...
CPU Analysis Methodology• Capture event traces (ETW) on the device• Use XPerf trace analysis tool to visualize CPU cost ac...
Example: Jerky TOC SnappingSituation• TOC snapping animation is jerky (12fps on Surface RT)Opportunity• Cycle of measuring...
Goal: Ads do not block Onload• Onload has impact on perceived performance, such as the ‘Done’ indicator• Onload is used to...
Key Findings for MSN• Define and maintain perf budgets• Test as near to Prod as possible• Know your dependencies– Avoid 3r...
References• Visual Studio ALM + Team Foundation Server Bloghttp://blogs.msdn.com/b/visualstudioalm/• Profiling Windows 8 a...
Q&A
Методология и практический опыт тестирования быстродействия приложений, сервисов и сайтов с высокой нагрузкой с помощью Vi...
Upcoming SlideShare
Loading in …5
×

Методология и практический опыт тестирования быстродействия приложений, сервисов и сайтов с высокой нагрузкой с помощью Visual Studio 2012

491 views

Published on

Доклад Евгения Чигиринского, SQA Days-13, 26-27 апреля 2013, www.sqadays.com

Published in: Education, Technology
  • Be the first to comment

  • Be the first to like this

Методология и практический опыт тестирования быстродействия приложений, сервисов и сайтов с высокой нагрузкой с помощью Visual Studio 2012

  1. 1. Методология и практический опыттестирования быстродействия приложений,сервисов и сайтов с высокой нагрузкой спомощью Visual Studio 2012Евгений Чигиринский Microsoft Corp.
  2. 2. Содержание• Методологии тестированиякачества и нагрузки– пробы и ошибки• От методологии – к практике напримере msn.com– Visual Studio Profiler– Тестирование нагрузки в условияхавтоматического управления датацентрами– Тестирование быстродействия наклиентской части
  3. 3. Why MSN?• 19 лет online• Траффик главной страницы (www.msn.com) – больше чем 4.3миллиарда просмотров за месяц• Постоянно в Top 20 сайтов мира• Очень высокие требования к производительности сайта• Присутствует во многих странах мира– Порталы (www.msn.ru)– Тематические сайты (http://cars.uk.msn.com/)
  4. 4. • What does High Quality mean?• Resilience Quality• Environment Quality• Diagnostics & Monitoring Quality• Configurability• Maintainability
  5. 5. What does High Quality mean?Quality is not justworking FunctionalityContributors to High Quality
  6. 6. Service Resilience QualityFault ToleranceRecover from Fault conditionsDegrade GracefullyHow to Test? – Fault Injection!“Chaos Monkey”Handling Human ErrorsConfiguration ManagementFile & backup ManagementPerformance thresholdsIf you don’t play well, we don’t play with you!Throttling CapabilitiesDependency mappingAvoids potential failuresReduces Mitigation TimeBetter Prediction of ImpactsLowers Maintenance Risk and Increases Efficiency“Design for failure and nothing will fail!”“The best way to avoid failure is to fail constantly”Software should protect humans from making mistakes
  7. 7. Environment Quality• Test Environments in-sync with Production Environment• Design For Roll back• Solid Deployment testing in place• Test Rollback mechanisms thoroughly• Design for Human Error• Quality Gates and Checks in place to prevent Corruption of Environment• Configuration Changes should be treated like full fledged deployments• Operational Excellence• Mandatory Peer Reviews for Configuration changes & Script Executions
  8. 8. Diagnostics & Monitoring Quality• Monitoring Being Proactive Vs. Reactive Lower MTTD [Mean Time to Detect] Lower Downtime & Higher Availability Add Monitoring Capability when you are building the service - not after! Monitoring Testing should be part of Test plan Plan for Multiple levels of Monitoring – Watch dogs, FTIP, etc• Diagnostics• Ability to collect required data• More effective debugging and troubleshooting• Lower time to restore• How soon can we get the service back up and running
  9. 9. Maintainability• The ease with which the system can be:• Modified to meet new requirements• Modified to make future maintenance easier• Modified to correct defects• Adapted to a changed environment• Maintainability testing:• Maintainability Index• Cyclomatic Complexity• Class Inheritance• Class Coupling• Lines of Code
  10. 10. Methodology• Min InstallComponent Level Testing• Cluster Level Testing
  11. 11. Methodology : Minimal Installation• One Box Setup• Build the baseline (expectations)• Tuning for scenarios• See what comes from experiment (run)
  12. 12. Min Install - Performance Load andStress Testing• Identify Production Scenarios (BVTs)– Confirm meeting original expectations– Define Baselines• Identify Max Throughput– Identify Bottlenecks (always start one to many)– Identify Ceiling (how much work you can do with the system – can be memory, IO, CPU)– Identify Capacity– How it behaves beyond the limit• Failure Scenarios (stress testing)– Finding failure conditions, pushing the app to failure scenarios– Examples:• Too much traffic• Too much memory/cache items• Too many connections (resource starvation)• Network IO/Disk IO– Failing gracefully• Endurance Testing– Issues/Concerns happening over time (usually over 72 hours) – Leaks, Disk space, Timed events
  13. 13. Methodology : Cluster Level Testing• Integration Testing• Prod simulation (IIS Playback, SQL playback, etc)• Testing new behavior for new features• Failing gracefully• Load Test In Production (LTIP)
  14. 14. Performance is important• How to improve it?– Measure– Fix– Measure again• How to measure it with VS?– VS Profiler
  15. 15. What is VS Profiler?• Performance measurement tool• Process orientedUltimate Premium Professional Express
  16. 16. Common Performance Issue• High CPU utilization• I/O bottleneck• Tiers interaction• Resource contention, Poor core utilization• Memory issues
  17. 17. High CPU utilization• Sampling: statistical form of CPU profiling• Choose Sampling when– CPU is the critical resource– Low overhead is required• Non-intrusive• Samples != Time
  18. 18. Sampling Profiling• void Alpha()• {•• Beta();• }• void Beta()• {• }30 samples50 samplesExclusive InclusiveAlphaBeta 50 5030 80
  19. 19. Sampling Profiling Call Tree
  20. 20. Q&A
  21. 21. I/O bottleneck• Instrumentation: method timing profiling• Choose Instrumentation when– CPU usage is low– Exact function call counts are necessary– Exact timing is necessary• Higher overhead• Intrusive
  22. 22. Instrumentation Profiling• void MyFunction()• {• FUNC_ENTER(MyFunction);• . . .• CALL_ENTER(WriteFile);• // Call another function• WriteFile(...);• CALL_EXIT(WriteFile);• . . .• FUNC_EXIT(MyFunction);• }Elapsed TimeApplicationTimeApplicationTime
  23. 23. Instrumentation Profiling Call Tree
  24. 24. Managed memory profiling• Allocation data– Allocated type– Allocating call stack• Lifetime data– GC generations
  25. 25. More power to VS Profiler• Data collection– Remote profiling– ETW based collection– Various performance counters– Command line tools– APIsMultiproc collectionStandalone profilerCollect what you needAttach/Detach, Pause/Resume
  26. 26. VS Profiler - Limitations• Move to ETW in Visual Studio 2012• Windows 8 Limitations with CPU sampling– Tier Interaction Profiling data cannot be collected– The “Sampling” performance session cannot be configured– Windows performance counters cannot be collected while CPU sampling– NGEN-ed methods will not show real method names
  27. 27. Тестирование нагрузки в условиях автоматическогоуправления датацентрами
  28. 28. Automatic DC Management• Like a cloud, but with more control• Testing the deployment process• Monitoring
  29. 29. Monitoring• Deployment monitoring– Automated rollbacks• Watchdogs– Simple Watchdogs (disk space, CPU, etc)– User Watchdogs• service that monitors the production service– Set machine properties with centralized service• Alerts– Actions based on machine properties set by watchdog
  30. 30. Тестирование быстродействия наклиентской части
  31. 31. Что будет рассмотреноTTIPLTTTVPLT2TTGTTLBTTOTTFRTTFBVRTAMSNPIEKeynoteYSlowWebPageTestGomezWebRunnerЧто это за метрики?Как измерятьпроизводительность?Что можно сделать?
  32. 32. Метрики для оценки производительностиЗапросстраницыСервер посылаетHTML браузеруБраузер парсируетHTML, загружает JS иCSS, строит DOM,запрашиваетизображения.ОтображениепервоговидимогоэлементаОтображениевидимойстраницыЗагрузка последнеговидимого элементастраницы(чаще всего за экраном)Вся ресурсыстраницызагружены.Browser fireson-load eventBeaconsare firedПриемпоследнегобайтастраницы.Производительность«сервера»TTLBTime tolast byteTTFBTime tofirst byteTTFRTime tofirst renderTTVTime tolast visualTTOTime toOnLoadTAFRAbove foldrenderPage Load Time - PLTperceived approximated
  33. 33. Какие метрики производительностинужно использовать?TTLBTime tolast byteTTFBTime tofirst byteTTFRTime tofirst renderTTVTime tolast visualTTOTime toOnLoadTAFRAbove foldrenderPerceived Approximated
  34. 34. Performance Optimizations• Images loaded optimally in phases• Async script loading• JS execution in multiple phases• Testing on real mobile devices• Optimized ad loading• Other optimizations
  35. 35. Optimal Image LoadingDefine and maintain Performance budget– PLT goal permits only 400KB weight at 100% bandwidth efficiency (less inpractice)Responsive design– Need to load different images based on view mode (e.g. Snap view);determined client-side– Load images in phases
  36. 36. CPU Analysis Methodology• Capture event traces (ETW) on the device• Use XPerf trace analysis tool to visualize CPU cost across IE subsystems– JavaScript, CSS, Formatting, Layout, Display etc.• Identify bottlenecks and JS code paths responsible for them
  37. 37. Example: Jerky TOC SnappingSituation• TOC snapping animation is jerky (12fps on Surface RT)Opportunity• Cycle of measuring and updating CSS position of TOC as userscrolls down results in costly recalculation of entire layout tree withevery loop iteration• 80ms CPU time for each cycle results in jerky animation
  38. 38. Goal: Ads do not block Onload• Onload has impact on perceived performance, such as the ‘Done’ indicator• Onload is used to trigger secondary functionalityExample: Optimized Ad LoadOnload Ad request blocks OnloadSolution:• Modify ads handling code to avoid blocking of OnloadOnload Ad request does not block Onload
  39. 39. Key Findings for MSN• Define and maintain perf budgets• Test as near to Prod as possible• Know your dependencies– Avoid 3rd party libraries that are not designed with performance in mind• Make sure that your sample data is valid• Monitoring is the key• Visual Studio Profiler helps finding issues quickly!
  40. 40. References• Visual Studio ALM + Team Foundation Server Bloghttp://blogs.msdn.com/b/visualstudioalm/• Profiling Windows 8 and Windows Server 2012 applicationshttp://msdn.microsoft.com/en-us/library/hh974575.aspx• Configuring the profiler as part of your load testing in Visual Studiohttp://msdn.microsoft.com/en-us/library/dd504817.aspx• Load Testing in Visual Studio 2012http://blogs.msdn.com/b/visualstudioalm/archive/2012/06/04/getting-started-with-load-testing-in-visual-studio-2012.aspx• VS Profiler – CPU Samplinghttp://blogs.msdn.com/b/visualstudioalm/archive/2013/02/27/how-to-profile-a-xaml-windows-store-app.aspx• Profiling .NET Memory Allocationhttp://blogs.msdn.com/b/dotnet/archive/2013/04/04/net-memory-allocation-profiling-with-visual-studio-2012.aspx
  41. 41. Q&A

×