Upload
hujak-hrvatska-udruga-java-korisnika-croatian-java-user-association
View
1.116
Download
3
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
Oružje u redovima Oružje u redovima performansnog testiranja
Andrija Kranjec
Agenda
• Što je Gatling?
• Problemi kod alata za testiranje
• Gatling kao rješenje
• Demo• Demo
• Testiranje JVM aplikacija
Što je Gatling?
Sliku ustupio Dean Sekulić (Croteam)
Gatling je alat za simulaciju opterećenja na testiranoj aplikaciji,
provodi pripadna mjerenja i provodi pripadna mjerenja i prezentira rezultate provedenog
performansnog testiranja.
Još jedan u nizu alata
Problemi kod alata za testiranjeProblemi kod alata za testiranje
Cijena
Photo by Siphiwe Sibeko / Reuters
1 dretva = 1 korisnik
Photo by Alessandro Garofalo / Reuters
Dretve čekaju…
Photo by Larry Downing / Reuters
…i spavaju.
Photo by Stringer Shanghai / Reuters
Komplicirano sučelje
Photo by Ben Cooper
• Baziran na Actor Modelu
• Asinkron• Koristi Non-Blocking algoritme
Gatling kao rješenje
• Koristi Non-Blocking algoritme
Lako pisanje testova*Lako pisanje testova**pod uvjetom da ste programer
Testovi se pišu korištenjem Gatling DSL-a koji je implementiran u Scala programskom jeziku.
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
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
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
Napiši jednomNapiši jednom
Recikliraj stare testove
Photo by Stringer Shanghai / Reuters
Nema izlike za sistemaše...Nema izlike za sistemaše...
…postoji recorder.
Izvještaji
DemoDemo
Planirajte opterećenje
Izvor http://www.zadarskilist.hr/
Opteretili smo aplikaciju, a što dalje?Opteretili smo aplikaciju, a što dalje?
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
Demo - rezultatiDemo - rezultati
Pitanja?