challenges, benefits and best practices of performance focused...

70
Wolfgang Gottesheim @gottesheim Challenges, Benefits and Best Practices of Performance Focused DevOps

Upload: others

Post on 25-Jun-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

1 #Dynatrace

Wolfgang Gottesheim @gottesheim

Challenges, Benefits and Best Practices of Performance Focused DevOps

Page 2: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute
Page 3: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

3 #Dynatrace

? ? ?

Unit/IntegrationTests

Acceptance Tests

CapacityTests

ReleaseDevelopers

When do we find performance problems?

Page 4: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute
Page 5: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute
Page 6: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute
Page 7: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute
Page 8: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

Test

Page 9: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

Production

Page 10: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

Dev Ops

Page 11: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

11 #Dynatrace

What Operations tells Developers…

Page 12: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

12 #Dynatrace

What Developers would like to know

Page 13: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

13 #Dynatrace

What Developers would like to knowTop contributor is save of

Mage_Core_Model_Abstract

70% of that time comes from Sales_Model_Quote

Where are those calls coming from?

Page 14: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute
Page 15: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute
Page 16: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

BecauseNOBODY wants this …

Page 17: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute
Page 18: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

~80% of problems

caused by ~20% patterns

YES we know this

80% Dev Time in Bug Fixing

$60B Defect Costs

BUT

Page 19: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

19 #Dynatrace

• Define metrics that are understood across teams

• Share measurement methods and tools

• Make performance part of agile stories

Broaden the View

Page 20: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

20 #Dynatrace

Page 21: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

21 #Dynatrace

But…

Page 22: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

22 #Dynatrace

It’s a culture thing

Page 23: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

23 #Dynatrace

Culture Measure ShareAutomation

Page 24: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

24 #Dynatrace

Starting from…

Production Environment

Developers CI Server TestingEnvironment

Release

Page 25: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

25 #Dynatrace

…or maybe…

Production Environment

Developers CI Server TestingEnvironment

Release

Page 26: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

26 #Dynatrace

We want to get to…

Commit Stage

Automated Acceptance

Testing

Automated CapacityTesting

ReleaseDevelopers

Page 27: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

METRICS to look at,

WHY we want them,

HOW they help

Page 28: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

Queues and Pools

Page 29: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

29 #Dynatrace

Online Banking: Slow Balance Check

1.69min (=101s!) To check balance!

87% spent in IIS 600! SQL Executions

Page 30: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

30 #Dynatrace

#1: Time Spent in IIS?

Thread 32 in IIS took 87s to pass control to Thread 30 in ASP.NET

Page 31: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

31 #Dynatrace

#2: SQL Executions!A new connection for every

statement…

Page 32: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

32 #Dynatrace

#2: SQL Executions! continued …

#1: Same SQL is executed 67! times

#2: NO PREPARATIONbecause everything

executed on new Connection

Page 33: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

33 #Dynatrace

Lessons Learned!

ASP.NET Worker Thread Pool Sizing!

DB Connection PoolsMore Efficient SQL

Page 34: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

34 #Dynatrace

Helpful Metrics

• Idle vs. Busy Threads• # SQLs / Request• # Opened connections

Page 35: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

Push without Plan

Page 36: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

36 #Dynatrace

Mobile Landing Page of Super Bowl Ad

434 Resources in total on that page:230 JPEGs, 75 PNGs, 50 GIFs, …

Total size of ~ 20MB

http://apmblog.dynatrace.com/2014/01/31/technical-and-business-web-performance-tips-for-super-bowl-ad-landing-pages/

Page 37: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

37 #Dynatrace

m.store.com redirects to www.store.com

ALL CSS and JS files are

redirected to the www domain

This is a lot of time “wasted” especially on high latency mobile

connections

http://apmblog.dynatrace.com/2013/12/02/the-terrible-website-performance-mistakes-of-mobile-shopping-sites-in-2013/

Page 38: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

38 #Dynatrace

Fifa.com during Worldcup

http://apmblog.dynatrace.com/2014/05/21/is-the-fifa-world-cup-website-ready-for-the-tournament/

Page 39: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

Helpful Metrics

• Load Time• # Images• # Redirects• # HTTP 3xx, 4xx, 5xx• Size of resources

Page 40: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

ReusingComponents

Page 41: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

Requirement: We need a report

Page 42: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

Using Hibernate results in 4k+ SQL Statements to display 3 items!

Hibernate Executes 4k+ Statements

Individual Execution VERY

FAST

But Total SUM takes 6s

http://apmblog.dynatrace.com/2014/04/23/database-access-quality-metrics-for-your-continuous-delivery-pipeline/

Page 43: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

Helpful Metrics

• # SQL Statement Executions• # of same SQLs• Result Set Size

Page 44: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

Tools andFrameworks

Page 45: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

45 #Dynatrace

Online Bank: Transaction History CSV Download!

Building CSV output in memory…

Problem: Takes 207s! To download. 87%of Time spent in Garbage Collection

Page 46: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

46 #Dynatrace

Online Store: Rendering Search ResultProblem: 4.4s to render result page

Root Cause: Custom RegEx Library with performance issues on large strings

Page 47: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

Helpful Metrics

• Memory Usage• Time Spent in APIs

Page 48: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

ArchitecturalDecisions

Page 49: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

49 #Dynatrace

• Symptoms

• HTML takes between 60 and 120s to render

• High GC Time

• Assumptions

• Bad GC Tuning

• Probably bad Database Performance as rendering was simple

Project: Online Room Reservation System

Page 50: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

50 #Dynatrace

Developers built own monitoring

void roomreservationReport(int roomid)

{

long startTime = System.currentTimeMillis();

Object data = loadDataForRoom(roomid);

long dataLoadTime = System.currentTimeMillis() - startTime;

generateReport(data, roomid);

}

Result:

Avg. Data Load Time: 45s!

DB Tool says:

Avg. SQL Query: <1ms!

Page 51: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

51 #Dynatrace

#1: Loading too much data24889! Calls to the

Database API!

High CPU and High Memory Usage to keep all

data in Memory

Page 52: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

52 #Dynatrace

#2: On individual connections 12444!individual

connections

Classical N+1 Query Problem

Individual SQL really <1ms

Page 53: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

53 #Dynatrace

#3: Putting all data in temp Hashtable

Lots of time spent in

Hashtable.get

Called from their Entity Objects

Page 54: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

54 #Dynatrace

• Custom Measuring

• Was impacted by Garbage Collection

• Just measured overall time but not # SQL Executions

• Learn SQL and don’t use Hashtables as Workaround

Lesson Learned

void roomreservationReport(int roomid)

{

long startTime = System.currentTimeMillis();

Object data = loadDataForRoom(roomid);

long dataLoadTime = System.currentTimeMillis() - startTime;

generateReport(data, roomid);

}

Page 55: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

Helpful Metrics

• # SQL Executions• # of SAME SQLs• Connection Acquisition Time

Page 56: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

56 #Dynatrace

Performance as a Quality Gate

Automated collection of performance metrics in test runs

Comparison of performance metrics across builds

Automated analysis of performance metrics to identify outliers

Automated notifications on performance issues in tests

Measurements accessible and shareable across teams

Actionable data through deep transactional insight

Integration with build automation tools and practices

Page 57: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

57 #Dynatrace

PERFORMANCE as part of our Continuous Delivery Process

Commit Stage

Automated Acceptance

Testing

Automated CapacityTesting

ReleaseDevelopers

Page 58: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

58 #Dynatrace

•# Images

•# Redirects

•Size of Resources

•# SQL Executions

•# of SAME SQLs

•# of Connections

•Time Spent in API

Remember: Use Tools to measure…

•# Calls into API

•# Functional Errors

•3rd Party calls

•# of Domains

•Total Page Size

•# Items per Page

•# A JAX per Page

Page 59: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

Performance Scalability

Page 60: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

Collaborate VerifyMeasure

Page 61: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute
Page 62: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute
Page 63: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

If we do all that …

Page 64: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

64

Unit/IntegrationTests

Acceptance Tests

CapacityTests

ReleaseDevelopers

Page 65: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

blog.dynatrace.com

bit.ly/dttrial

Page 66: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

A FINAL THOUGHT!

Page 67: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute
Page 68: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

Putting it into Test Automation

12 0 120ms

3 1 68ms

Build 20 testPurchase OK

testSearch OK

Build 17 testPurchase OK

testSearch OK

Build 18 testPurchase FAILED

testSearch OK

Build 19 testPurchase OK

testSearch OK

Build # Test Case Status # SQL # Excep CPU

12 0 120ms

3 1 68ms

12 5 60ms

3 1 68ms

75 0 230ms

3 1 68ms

Test Framework Results Architectural Data

We identified a regresesion

Problem solved

Exceptions probably reason for

failed testsProblem fixed but now we have an

architectural regression

Problem fixed but now we have an

architectural regressionNow we have the functional and

architectural confidence

Let’s look behind the

scenes

Page 69: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

And in your Pipeline

Commit Stage• Compile• Execute Unit Test• Code Analysis• Build installers

Automated Acceptance

Testing

Automated Capacity Testing

Manual testing• Key showcases• Exploratory testing Release

Unit & Integration Tests

Functional Tests

Performance TestsProductionMonitoring

Functional Tests

Page 70: Challenges, Benefits and Best Practices of Performance Focused DevOpslt2015.eecs.yorku.ca/talks/LTWorkshop.pdf · 2015-02-03 · And in your Pipeline Commit Stage •Compile •Execute

73 @Dynatrace

Wolfgang GottesheimFree Tools: http://bit.ly/dttrial

Follow me @gottesheim

Email me [email protected]

http://blog.dynatrace.com