gatling - bordeaux jug

62
Stéphane Landelle CTO eBusiness Information @slandelle Performance & Load Testing

Upload: slandelle

Post on 29-Nov-2014

2.221 views

Category:

Documents


7 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Gatling - Bordeaux JUG

Stéphane Landelle

CTOeBusiness Information

@slandelle

Performance & Load Testing

Page 2: Gatling - Bordeaux JUG

Concepts

Page 3: Gatling - Bordeaux JUG

Define performance?● fast?● robust?● resource effective?

=> Define your requirements!

Page 4: Gatling - Bordeaux JUG

Web speed is a user experience

● <0,5 s : loading looks instantaneous

● 0,5-2 s : not instantaneous, but acceptable

● > 3 s : users start leaving your site

Page 5: Gatling - Bordeaux JUG

Put things into perspective

Product Owner requirement : Every page should show up under 200ms

WRONG !

User expectations = per use case!

Page 6: Gatling - Bordeaux JUG

Speed matters

● More traffic

● Better conversion rate

● Less angry users

Page 7: Gatling - Bordeaux JUG

Some figures

Google :Results/page : 10 => 30 -> +500 ms -> -20% pages seen

Amazon :+100 ms -> -1 % salesestimated annual cost : $160M

Page 8: Gatling - Bordeaux JUG

Load tests : why ?

Load tests =

know your app & infrastructure

No load tests=

potential problems in production=

angry users

Page 9: Gatling - Bordeaux JUG

Methodology

Clicking everywhere/Selenium = not a load test !

● You expect more than 1 user

● "Seems fast enough." => Not a metric !

Page 10: Gatling - Bordeaux JUG

Methodology

Comes after proper local perf testing

● Client/Network optimization: minification, javascript, sprites, caching...○ Tools : Developer Tools, YSlow, Google PageSpeed

Insights...

● Application debugging: 50 SQL queries/page = BUG!○ Tools : VisualVM, Yourkit, JProfiler, MAT...

Page 11: Gatling - Bordeaux JUG

Methodology

● Analyze = Data = Monitoring

● Fix hotspot

● Iterate!

Page 12: Gatling - Bordeaux JUG

Tooling

● Load injector: Gatling, JMeter, Locust.io...

● JVM monitoring: JMXtrans, Yammer Metrics...

● System monitoring: Nagios

● Network monitoring

● Database monitoring

● Dashboard: Graphite, Ganglia

● Webapp mock: H. Gomez's basic perf webapp

Page 13: Gatling - Bordeaux JUG

Types of load tests

● Capacity Test

● Stress Test

● Endurance Test

Page 14: Gatling - Bordeaux JUG

Capacity Test

Goal : Determine how much load your system can hold

How :Repeat the same scenario over and over, but add virtual users every time until performance starts degrading.

Page 15: Gatling - Bordeaux JUG

A response time under 1 s is expected

-> user cap : 1500 users

Page 16: Gatling - Bordeaux JUG

Stress Test

Goal :Study system behavior in case of heavy load, during AND after

How : Find the max load your system can handle, and then run the scenario with a heavier load.

Page 17: Gatling - Bordeaux JUG

10k users for 1 min, then 1k : webapp struggles, but stabilizes

Page 18: Gatling - Bordeaux JUG

Endurance Test

Goal :Validate system behavior after a long period of activity.

How :Run the scenario with a manageable load, but for a long period of time (several hours at least).

Page 19: Gatling - Bordeaux JUG

Fast memory leak :Runs fine for 2 minutes until heap's full...

Page 20: Gatling - Bordeaux JUG

Ramps

Start virtual users progressively, because that's what real users do !Ramps also help to warm up your system.

Page 21: Gatling - Bordeaux JUG

Reports

The purpose of load injectors : stress your app and produces reports

● Meaningful reports help developers analyze stress tests results and what to make of them

● Something shiny to give to your boss

Page 22: Gatling - Bordeaux JUG

The good, the bad and the ugly metrics

Every metric can be useful, but some less than others...

● Response time min/max = worst case/best case

● Mean can be biased in case of extreme values

Response time is a physical phenomenon=> Statistically distributed

Page 23: Gatling - Bordeaux JUG
Page 24: Gatling - Bordeaux JUG

Percentiles to the rescue

nth percentiles =

n % of users' response time

Page 25: Gatling - Bordeaux JUG

Part of the development process

Like any other functional test, load testing should be :

● integrated early in the development cycle

● automated

● versioned

Page 26: Gatling - Bordeaux JUG

Gatling

Page 27: Gatling - Bordeaux JUG

Yet Another Stress Tool

JMeter, Grinder, Tsung, LoadUI,

LoadRunner, Neoload…

Page 28: Gatling - Bordeaux JUG

High PerformanceIssue #1

http://www.shopfbparts.com/catalog/nal-19201331_w.jpg

Page 29: Gatling - Bordeaux JUG

1 user = 1 thread

Page 30: Gatling - Bordeaux JUG

With 50 threads on a JVM

Page 31: Gatling - Bordeaux JUG

With 2000 threads on a JVM

Page 32: Gatling - Bordeaux JUG

Blocking I/O

Page 33: Gatling - Bordeaux JUG

Threads? Waiting…

Page 34: Gatling - Bordeaux JUG

… and sleeping

Page 35: Gatling - Bordeaux JUG

Is that a real problem?

Page 36: Gatling - Bordeaux JUG

Can you trust your results?

JMeter 2.8 perf test, expecting 300 tr/sec

Page 37: Gatling - Bordeaux JUG

UsabilityIssue #2

Page 38: Gatling - Bordeaux JUG

Listen, it's not that complicated...

Graphical User Interface

Page 39: Gatling - Bordeaux JUG

MaintainabilityIssue #3

Page 40: Gatling - Bordeaux JUG

What was this change about?

Page 41: Gatling - Bordeaux JUG

Gatling can change all that!

http://static.lexpress.fr/medias/15/mai-68_124.jpg, copyright by AFP

Page 42: Gatling - Bordeaux JUG

Version 1.4.1Released January 2013

Say hello to my little friend…

Page 43: Gatling - Bordeaux JUG

Be asynchronous, embrace the actor model

Page 44: Gatling - Bordeaux JUG

Use non-blocking I/O

● Async HTTP Client● Netty

Page 45: Gatling - Bordeaux JUG

Scenario = Code (Scala) = DSL

Page 46: Gatling - Bordeaux JUG

Easy

Page 47: Gatling - Bordeaux JUG

Use the rich DSL…Checks

● regex / css / xpath / jsonPath

● find / findAll / count

● is / in / not / whatever

Structures

● doIf / repeat / during / asLongAs

● randomSwitch / roundRobinSwitch

Error handling

● tryMax / exitBlockOnFail

Feeders

● csv / tsv / jdbc

Page 48: Gatling - Bordeaux JUG

… or write your own Scala code…

Page 49: Gatling - Bordeaux JUG

…or use the Recorder

Page 50: Gatling - Bordeaux JUG

Integrations● Maven Plugin● Maven archetype (run in IDE)

● Jenkins plugin

● Graphite live reporting

Page 51: Gatling - Bordeaux JUG

Coming soon…

● Websockets, JDBC…● Clustering

Page 52: Gatling - Bordeaux JUG

Demo

Page 53: Gatling - Bordeaux JUG

Gatling at Ezakus

Page 54: Gatling - Bordeaux JUG

Ezakus Architecture

Page 55: Gatling - Bordeaux JUG

Metrics

110 M Http hits by day

Peak : 3 000 req/s

Page 56: Gatling - Bordeaux JUG

Gatling usage - Simulations

Page 57: Gatling - Bordeaux JUG

Gatling usage - Example

Page 58: Gatling - Bordeaux JUG

Gatling usage - Results

Page 59: Gatling - Bordeaux JUG

Gatling usage - Results

Page 60: Gatling - Bordeaux JUG

Conclusion

Page 61: Gatling - Bordeaux JUG

Really efficient?

Jmeter perf test run with Gatling, expecting 300

tr/sec

Page 62: Gatling - Bordeaux JUG

http://gatling-tool.orghttps://github.com/excilys/gatling@GatlingTool

https://github.com/slandelle@slandelle