29
Oružje u redovima Oružje u redovima performansnog testiranja Andrija Kranjec

JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec

Embed Size (px)

DESCRIPTION

Non-functional testing is an important, but often ignored step in the process of developing applications. Gatling is a tool that enables us to simulate load, performs the associated measurement and presents the results of the performance testing. Why is Gatling detected by the ThoughtWorks radar? Because it is based on Akka, Netty and Scala technologies and so this lecture will show that writing performance scripts don’t have to be boring. With the concept and methodology of performance testing, using Gatling, the author will present personal experiences from previous projects testing the JVM applications.

Citation preview

Page 1: JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec

Oružje u redovima Oružje u redovima performansnog testiranja

Andrija Kranjec

Page 2: JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec

Agenda

• Što je Gatling?

• Problemi kod alata za testiranje

• Gatling kao rješenje

• Demo• Demo

• Testiranje JVM aplikacija

Page 3: JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec

Što je Gatling?

Sliku ustupio Dean Sekulić (Croteam)

Page 4: JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec

Gatling je alat za simulaciju opterećenja na testiranoj aplikaciji,

provodi pripadna mjerenja i provodi pripadna mjerenja i prezentira rezultate provedenog

performansnog testiranja.

Page 5: JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec

Još jedan u nizu alata

Page 6: JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec

Problemi kod alata za testiranjeProblemi kod alata za testiranje

Page 7: JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec

Cijena

Photo by Siphiwe Sibeko / Reuters

Page 8: JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec

1 dretva = 1 korisnik

Photo by Alessandro Garofalo / Reuters

Page 9: JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec

Dretve čekaju…

Photo by Larry Downing / Reuters

Page 10: JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec

…i spavaju.

Photo by Stringer Shanghai / Reuters

Page 11: JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec

Komplicirano sučelje

Photo by Ben Cooper

Page 12: JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec

• Baziran na Actor Modelu

• Asinkron• Koristi Non-Blocking algoritme

Gatling kao rješenje

• Koristi Non-Blocking algoritme

Page 13: JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec

Lako pisanje testova*Lako pisanje testova**pod uvjetom da ste programer

Page 14: JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec

Testovi se pišu korištenjem Gatling DSL-a koji je implementiran u Scala programskom jeziku.

Page 15: JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec

Definiranje scenarija - opisuju ponašanja virtualnih korisnikascenarioexec / group / pause / pauseExp / pauseCustomdoIf / doIfOrElse / randomSwitch / roundRobinSwitchrepeat / during / asLongAs / foreachtryMax / exitBlockOnFail / exitHereIfFailed

Definiranje feedera - ubacivanje podataka u scenarijcsv / tsv / ssv / jdbc / redisFeeder

Gatling DSL

csv / tsv / ssv / jdbc / redisFeederqueue / random / circular

Konfiguracija scenarija - manipulacija izvršavanjausers / ramp / delay / protocolConfig

HTTP akcije - upravljanje HTTP zahtjevimahttpget / post / put / delete / headqueryParam / header / headers / basicAuthbody / fileBody / byteArrayBody / param / upload

Page 16: JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec

Provjere - provjera sadržaja odgovoracheckstatus / currentLocation / header / headerRegex / responseTimeInMillis / latencyInMillisregex / xpath / jsonPath / css / md5 / sha1find / findAll / counttransformis / not / exists / notExists / in / whateversaveAs

HTTP konfiguracija – upravljanje Gatlingovim HTTP klijentom

Gatling DSL

HTTP konfiguracija – upravljanje Gatlingovim HTTP klijentomhttpconfigbaseURL / baseURLs / proxy / httpsPort / credentialsacceptHeader / acceptCharsetHeader / acceptEncodingHeader / acceptLanguageHeader / hostHeader / userAgentHeaderdisableFollowRedirect / disableAutomaticReferer / disableWarmUp / warmUprequestInfoExtractor / responseInfoExtractor / disableResponseChunksDiscarding

Page 17: JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec

Assertions – postavljanje nefunkcionalnih zahtjeva na razini scenarijaassertThatglobal / detailsresponseTime / allRequests / failedRequests / successfulRequests /requestsPerSecmin / max / mean / stdDev / percentiles1 / percentiles2percent / countlessThan / greaterThan / between / is / in / assert

Gatling DSL

Page 18: JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec

Napiši jednomNapiši jednom

Page 19: JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec

Recikliraj stare testove

Photo by Stringer Shanghai / Reuters

Page 20: JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec

Nema izlike za sistemaše...Nema izlike za sistemaše...

Page 21: JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec

…postoji recorder.

Page 22: JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec

Izvještaji

Page 23: JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec
Page 24: JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec

DemoDemo

Page 25: JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec

Planirajte opterećenje

Izvor http://www.zadarskilist.hr/

Page 26: JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec

Opteretili smo aplikaciju, a što dalje?Opteretili smo aplikaciju, a što dalje?

Page 27: JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec

Monitoring JVM aplikacije

• CPU

• Heap memorija

• Garbage collector rate

• Thread pool

• Webcontainer pool• Webcontainer pool

• JDBC (time, connection pool,..)

• Prepare statement cache

• Response time portleta/servleta

Page 28: JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec

Demo - rezultatiDemo - rezultati

Page 29: JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec

Pitanja?