Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Stresstests with Gatling

Stresstests with Gatling

Talk from Jax 2016, JUG CH 2016, BedCon 2016

395d9a1bac6f64d04bbd713d5b6bc433?s=128

Niko Köbler

April 20, 2016
Tweet

Transcript

  1. STRESSTESTS WITH GATLING NO MORE WITH YOUR TESTS STRESS Niko

    Köbler So ware-Architect, Developer & Trainer | | niko@n-k.de www.n-k.de @dasniko
  2. @dasniko

  3. None
  4. None
  5. METER J http://jmeter.apache.org

  6. TON'S OF XML CONFIGURATION

  7. None
  8. None
  9. THE NEW KID IN TOWN http://gatling.io

  10. based on SCALA, AKKA & NETTY NON-BLOCKING ASYNCHRONOUS

  11. Wait... what? SCALA? DSL!

  12. GETTING STARTED Download zip bundle Use Maven < d e

    p e n d e n c y > < g r o u p I d > i o . g a t l i n g . h i g h c h a r t s < / g r o u p I d > < a r t i f a c t I d > g a t l i n g - c h a r t s - h i g h c h a r t s < / a r t i f a c t I d > < v e r s i o n > 2 . 2 . 0 < / v e r s i o n > < / d e p e n d e n c y > Use SBT l i b r a r y D e p e n d e n c i e s + = " i o . g a t l i n g . h i g h c h a r t s " % " g a t l i n g - c h a r t s - h i g h c h a r t s " ...or use 3rd party extensions
  13. GATLING RECORDER

  14. None
  15. GATLING RECORDER works as HTTP PROXY or CONVERTER HAR ...and

    has an API
  16. EXECUTING

  17. BROWSER SIMULATION v a l h t t p C

    o n f = h t t p . b a s e U R L ( " h t t p : / / l o c a l h o s t : 8 0 8 0 " ) . a c c e p t H e a d e r ( " t e x t / h t m l , a p p l i c a t i o n / x h t m l + x m l , a p p l i c a t i o n / x m l ; q = 0 . 9 , * / * ; q = . d o N o t T r a c k H e a d e r ( " 1 " ) . a c c e p t L a n g u a g e H e a d e r ( " e n - U S , e n ; q = 0 . 5 " ) . a c c e p t E n c o d i n g H e a d e r ( " g z i p , d e f l a t e " ) . u s e r A g e n t H e a d e r ( " M o z i l l a / 5 . 0 ( W i n d o w s N T 5 . 1 ; r v : 3 1 . 0 ) G e c k o / 2 0 1 0 0 1 0 1 F i r e
  18. FEEDER v a l c s v F e e

    d e r = c s v ( " v a l u e s . c s v " ) . c i r c u l a r csv, tsv, ssv jsonFile, jsonUrl jdbcFeeder redisFeeder queue, circular, random
  19. VALUES.CSV k e y , v a l u e

    j o h n , 2 3 j a m e s , 4 2 j a c o b , 1 3 3 7
  20. TEST SCENARIO v a l s c n = s

    c e n a r i o ( " B a s i c S i m u l a t i o n " ) . f e e d ( c s v F e e d e r ) . e x e c ( h t t p ( " r e q u e s t _ 1 " ) . g e t ( " / " ) . q u e r y P a r a m ( " $ { k e y } " , " $ { v a l u e } " ) )
  21. HOW MANY USERS? atOnceUsers(1) rampUsers(500) constantUsersPerSec(1000) during (10) http://gatling.io/#/cheat-sheet/2.2.0

  22. SETUP AND ASSERTIONS s e t U p ( s

    c n . i n j e c t ( a t O n c e U s e r s ( 1 ) ) ) . p r o t o c o l s ( h t t p C o n f ) . a s s e r t i o n s ( g l o b a l . r e s p o n s e T i m e . m a x . l e s s T h a n ( 5 0 ) , g l o b a l . s u c c e s s f u l R e q u e s t s . p e r c e n t . g r e a t e r T h a n ( 9 5 ) )
  23. PUTTING IT ALL TOGETHER c l a s s L

    o a d S c e n a r i o e x t e n d s S i m u l a t i o n { v a l c s v F e e d e r = c s v ( " v a l u e s . c s v " ) . c i r c u l a r v a l h t t p C o n f = h t t p . b a s e U R L ( " h t t p : / / l o c a l h o s t : 8 0 8 0 " ) . a c c e p t H e a d e r ( " t e x t / h t m l , a p p l i c a t i o n / x h t m l + x m l , a p p l i c a t i o n / x m l ; q = 0 . 9 , * / * ; . d o N o t T r a c k H e a d e r ( " 1 " ) . a c c e p t L a n g u a g e H e a d e r ( " e n - U S , e n ; q = 0 . 5 " ) . a c c e p t E n c o d i n g H e a d e r ( " g z i p , d e f l a t e " ) . u s e r A g e n t H e a d e r ( " M o z i l l a / 5 . 0 ( W i n d o w s N T 5 . 1 ; r v : 3 1 . 0 ) G e c k o / 2 0 1 0 0 1 0 1 F i . d i s a b l e W a r m U p v a l s c n = s c e n a r i o ( " B a s i c R e d i s S i m u l a t i o n " ) . f e e d ( c s v F e e d e r ) . e x e c ( h t t p ( " r e q u e s t _ 1 " ) . g e t ( " / " ) . q u e r y P a r a m ( " $ { k e y } " , " $ { v a l u e } " ) ) s e t U p ( s c n . i n j e c t ( a t O n c e U s e r s ( 1 ) ) ) . p r o t o c o l s ( h t t p C o n f ) . a s s e r t i o n s ( g l o b a l . r e s p o n s e T i m e . m a x . l e s s T h a n ( 5 0 ) , g l o b a l . s u c c e s s f u l R e q u e s t s . p e r c e n t . g r e a t e r T h a n ( 9 5 )
  24. REPORTS

  25. None
  26. None
  27. None
  28. REALTIME MONITORING

  29. GRAPHITE PROTOCOL

  30. INFLUX DB Time-series data store. https://influxdata.com/

  31. GRAFANA Graph and Dashboard builder for visualizing time series metrics.

    http://grafana.org/
  32. GRAFANA DASHBOARD

  33. TESTING DISTRIBUTED BUILD-SLAVES FAT-JARS INFLUX (& GRAFANA)

  34. None
  35. TOOL GATLING Open Source: Professional Services: Support, Consulting & Training

    https://github.com/gatling/gatling gatling.io
  36. THANK ! YOU ANY ? QUESTIONS Niko Köbler So ware-Architect,

    Developer & Trainer | | niko@n-k.de www.n-k.de @dasniko https://github.com/dasniko/gatling-playground