W2 Performance Testing Wednesday, October 23rd, 2019 10:15 AM
How Fast Is My App? Performance Testing 101
Presented by:
Gene Gotimer
Coveros, Inc.
Brought to you by:
888---268---8770 ·· 904---278---0524 - [email protected] - http://www.starcanada.techwell.com/
Gene Gotimer
Gene Gotimer is a proven senior software architect with many years of experience in web-based enterprise application design, most recently using Java. He is skilled in agile software development as well as legacy development methodologies and designing and developing secure, high-quality software. He has extensive experience establishing and using development ecosystems including continuous integration, continuous delivery, DevOps, unit testing, and a variety of software assurance tools and supporting processes. Gene feels strongly that repeatability, quality, and security are all strongly intertwined; each of them is dependent on the other two, which just makes agile and DevOps that much more crucial to software development.
11/21/2019
How Fast is My App? Performance Testing 101 Gene Gotimer [email protected] @CoverosGene
Agility. Security. Delivered.
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 1
1
About Coveros
• Coveros helps companies accelerate the delivery of secure, reliable software using agile methods Development Platforms • Agile & DevOps Services • DevOps Implementation • DevSecOps Integration • Agile Transformations & Coaching • Agile Software Development • Agile Testing & Automation • Agile, DevOps, Testing, Security Training • Open Source Products • SecureCI – Secure DevOps toolchain • Selenified – Agile test framework
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 2
2
1 11/21/2019
Selected Commercial Clients
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 3
3
Selected Federal Clients
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 4
4
2 11/21/2019
What is Performance Testing?
I Love Lucy “Job Switching” © 1952 CBS
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 5
5
Principles of Performance Testing
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 6
6
3 11/21/2019
Page Loading Performance
• Users are selfish when it comes to page loading times. They don't care what is slowing it down or why, they just want the page to load quickly. • If they think it is too slow for them, it is too slow for them. • Browsers often have performance measurement and analysis capabilities in the web development tools.
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 7
7
Chrome Developer Tools
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 8
8
4 11/21/2019
Firefox Web Developer Tools
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 9
9
Google PageSpeed Insights
https://developers.google.com/speed/pagespeed/insights/
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 10
10
5 11/21/2019
Key Takeaway
• If the user says the page is loading too slowly for them, it is loading too slowly for them. No matter how fast it loads.
• Use browser and web site tools to measure page load speeds.
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 11
11
Principles of Performance Testing
What are we measuring? • How long does it take? Time behavior • How big a system do we need? Resource utilization • How much can we handle at once? Capacity
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 12
12
6 11/21/2019
Types of Performance Testing • Load testing • Stress testing • Scalability testing • Spike testing • Endurance testing • Concurrency testing • Capacity testing
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 13
13
Types of Performance Testing • Load testing • Stress testing • Scalability testing • Spike testing • Endurance testing • Concurrency testing • Capacity testing
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 14
14
7 11/21/2019
Types of Performance Testing • Load testing • Stress testing • Scalability testing • Spike testing • Endurance testing • Concurrency testing • Capacity testing
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 15
15
Types of Performance Testing • Load testing • Stress testing • Scalability testing • Spike testing • Endurance testing • Concurrency testing • Capacity testing
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 16
16
8 11/21/2019
Types of Performance Testing • Load testing • Stress testing • Scalability testing • Spike testing • Endurance testing • Concurrency testing • Capacity testing
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 17
17
Types of Performance Testing • Load testing • Stress testing • Scalability testing • Spike testing • Endurance testing • Concurrency testing • Capacity testing
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 18
18
9 11/21/2019
Types of Performance Testing • Load testing • Stress testing • Scalability testing • Spike testing • Endurance testing • Concurrency testing • Capacity testing
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 19
19
Key Takeaway
• Performance testing is a field, not a particular kind of test. Understand what you are trying to test for.
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 20
20
10 11/21/2019
Sorting App
• Spring Boot Java app • Static web page, links to REST calls • Sorting algorithms to sort 20,000 shuffled words • Different speeds to showcase performance results • Gatling and JMeter tests
https://github.com/Coveros/sorting
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 21
21
Gatling
• Load test tool • Open source version • Simulation scripts are written in Scala • but you don't need to know much • Includes a web recorder
https://gatling.io
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 22
22
11 11/21/2019
Gatling
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 23
23
Apache JMeter
• Load test tool • Free, open source • Very popular • Written in Java but tests are configured in XML or via GUI • Tests HTTP, HTTPS, SOAP, REST, JDBC, and more • Includes a web recorder
https://jmeter.apache.org
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 24
24
12 11/21/2019
Apache JMeter
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 25
25
Types of Performance Testing • Load testing • Stress testing • Scalability testing • Spike testing • Endurance testing • Concurrency testing • Capacity testing
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 26
26
13 11/21/2019
Testing Pyramid
Full-blown transaction numbers via the UI, endurance, capacity, and scalability End- to-end Testing User performance testing, concurrency, stress, and spike testing
Load testing via the UI
Functional Testing Load testing via the API
Baseline and trends of a representative selection of functional tests
Unit Testing Unit test times, isolated load tests
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 27
27
Unit Test Performance
• Performance of unit tests on critical logic can catch changes in performance early. • Repeat each test to create a baseline and assume some variation in runtimes.
• For example, if it usually takes 4.5s, you might fail at 5s or 6s
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 28
28
14 11/21/2019
Key Takeaway
• Remember the testing pyramid. Use a mix of isolated and end-to-end and in between.
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 29
29
Trends- not just absolute numbers
• Short JMeter or Gatling test • On development system, no isolation • 10 concurrent users for 10 minutes • Track the trend • Are we getting slower or faster?
• Full load and performance test • Dedicated environment, no other traffic • Production-sized servers • 1,000 concurrent users for 1 hour • What is the sustained capacity and throughput?
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 30
30
15 11/21/2019
JMeter Database Testing
• Used pgBadger to analyze PostgreSQL query logs • 4 queries represented 85% of the traffic • Wrote 4 JDBC Sampler tests in JMeter to match those queries • Looping in roughly the same proportion • Created baseline, then watched trends • Database changes were tested for performance impacts
http://pgbadger.darold.net
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 31
31
Key Takeaway
• Shift performance testing left. Get a baseline as early as possible.
• Trends may be easier to test for and just as actionable as absolute performance numbers.
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 32
32
16 11/21/2019
Testing is not enough
• Don't let performance be optional.
• Pick a performance metric, make it a quality gate, fail builds that do not pass.
• If you don't enforce it, it will be ignored.
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 33
33
Key Takeaway
• Break the build if you know something is too slow.
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 34
34
17 11/21/2019
#Coveros5 • If the user says the page is loading too slowly for them, it is loading too slowly for them. No matter how fast it is. • Performance testing is a field, not a particular kind of test. Understand what you are trying to test for. • Remember the testing pyramid. Use a mix of isolated and end-to-end and in between. • Trends may be easier to test for and just as actionable as absolute performance numbers. • Break the build if you know it is too slow.
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 35
35
Questions?
https://hub.techwell.com/ @Gene Gotimer
[email protected] @CoverosGene
@CoverosGene #STARCANADA © COPYRIGHT 2019 COVEROS, INC. ALL RIGHTS RESERVED. 36
36
18