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

Niko Köbler

April 20, 2016
Tweet

More Decks by Niko Köbler

Other Decks in Programming

Transcript

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

    Köbler So ware-Architect, Developer & Trainer | | [email protected] www.n-k.de @dasniko
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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 } " ) )
  7. 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 ) )
  8. 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 )
  9. THANK ! YOU ANY ? QUESTIONS Niko Köbler So ware-Architect,

    Developer & Trainer | | [email protected] www.n-k.de @dasniko https://github.com/dasniko/gatling-playground