load testing for developers with gatling - doag

27
Continuous Performance Load testing for developers with Gatling Bert Jan Schrijver @bjschrijver [email protected]

Upload: others

Post on 03-Oct-2021

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Load testing for developers with Gatling - DOAG

Continuous PerformanceLoad testing for developers with Gatling

Bert  Jan  Schrijver@[email protected]

Page 2: Load testing for developers with Gatling - DOAG

@bjschrijver@bjschrijver

Bert Jan Schrijver

Let’s meet

Page 3: Load testing for developers with Gatling - DOAG

@bjschrijver@bjschrijver

Outline• Performance testing process • Introduction to Gatling • Demo • Results • Looking forward • Summary • Q&A

Page 4: Load testing for developers with Gatling - DOAG

@bjschrijver@bjschrijver

How it all started…

Page 5: Load testing for developers with Gatling - DOAG

@bjschrijver@bjschrijver

Performance testing should be part of the process

Page 6: Load testing for developers with Gatling - DOAG

@bjschrijver@bjschrijver

Performance testing traditionally…

…happens several times per year…and/or at major releases …is performed by specialists

.. which is far from ideal:- changes were made long ago- many different code changes- at a certain moment in time - when is a test required?

Page 7: Load testing for developers with Gatling - DOAG

@bjschrijver@bjschrijver

Traditional performance testing

design

write code

test code

performance test

release

unit testsintegration tests

Page 8: Load testing for developers with Gatling - DOAG

@bjschrijver@bjschrijver

design

write code

test code

release

unit testsintegration testsperformance tests

Performance testing in continuous delivery

Page 9: Load testing for developers with Gatling - DOAG

@bjschrijver@bjschrijver

Continuous Delivery

Demands code to be

Always production ready

Short feedback cycles

Maintained by self-supportingteams

In regard to performance

Has to be under control

Effects should be clear ASAP

No external specialists

Page 10: Load testing for developers with Gatling - DOAG

@bjschrijver@bjschrijver

Part of the process

With the same level of support as - Unit-tests and integration tests - Continuous Integration - Zero-downtime deployments Performed by the development team

Page 11: Load testing for developers with Gatling - DOAG

@bjschrijver@bjschrijver

Performance testing process

Design Record Operationalise Execute Report

Page 12: Load testing for developers with Gatling - DOAG

@bjschrijver@bjschrijver

Designing scenarios

Generic tests used to test core functionality

Specialised tests used to test specific features

Page 13: Load testing for developers with Gatling - DOAG

@bjschrijver@bjschrijver

Tool support is key for performance test adoption

Page 14: Load testing for developers with Gatling - DOAG

@bjschrijver@bjschrijver

Gatlingpackage computerdatabase // 1

import io.gatling.core.Predef._ // 2 import io.gatling.http.Predef._ import scala.concurrent.duration._

class BasicSimulation extends Simulation { // 3

val httpConf = http // 4 .baseURL("http://computer-database.gatling.io") // 5 .acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") // 6 .doNotTrackHeader("1") .acceptLanguageHeader("en-US,en;q=0.5") .acceptEncodingHeader("gzip, deflate") .userAgentHeader("Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0")

val scn = scenario("BasicSimulation") // 7 .exec(http("request_1") // 8 .get("/")) // 9 .pause(5) // 10

setUp( // 11 scn.inject(atOnceUsers(1)) // 12 ).protocols(httpConf) // 13 }

Page 15: Load testing for developers with Gatling - DOAG

@bjschrijver@bjschrijver

Alternative tools

And many more…

Page 16: Load testing for developers with Gatling - DOAG

@bjschrijver@bjschrijver

Gatling core concepts

Scenario

Feeder

A sequence of http requests used to simulate application usage

A tool used to fill request parameters

Recorder The tool used to record http requests or take a HAR-file and convert it to Gatling DSL

Gatling DSL Easy-to-read, developer-friendly way of defining tests

Page 17: Load testing for developers with Gatling - DOAG

@bjschrijver

DEMO

Page 18: Load testing for developers with Gatling - DOAG

@bjschrijver@bjschrijver

Scenario to outcome

Browser HAR-file

Gatling recorder DSL

Custom changes DSL

Gatling Report

Page 19: Load testing for developers with Gatling - DOAG

@bjschrijver

DEMO

Page 20: Load testing for developers with Gatling - DOAG

@bjschrijver@bjschrijver

Reports

Page 21: Load testing for developers with Gatling - DOAG

@bjschrijver@bjschrijver

InterpretationsWe can See how changes affect performance Have feedback on performance in short amount of timeWe cannotSee which load the application can endure in production

Page 22: Load testing for developers with Gatling - DOAG

@bjschrijver@bjschrijver

Results so far

- At least one time prevented issues in production

- Helped testing performance fixes and database tuning

- Discovered configuration error in test infrastructure

- Helped track down and validate a fix for a memory leak

Page 23: Load testing for developers with Gatling - DOAG

@bjschrijver@bjschrijver

- Automate (re-)recording process - Re-use functional test scenarios as performance tests - Eliminate custom code changes

Further development

Page 24: Load testing for developers with Gatling - DOAG

@bjschrijver

SUMMARY

Page 25: Load testing for developers with Gatling - DOAG

@bjschrijver@bjschrijver

Some take-awaysPerformance testing should be a first class citizen in your development cycle

Frontend changes can impact backend performance

Gatling is an awesome programmer friendly tool for load testing

The approach I shared monitors performance trends - it does NOT determine the maximum load a production environment can endure

https://github.com/timve/continuous-performance-demo https://github.com/bertjan/gatling-seed

Page 26: Load testing for developers with Gatling - DOAG

@bjschrijver

Q&A

Page 27: Load testing for developers with Gatling - DOAG

@bjschrijver@bjschrijver

Thanks for your time!

Please care about conference quality.

Liked it? Tweet it!