SlideShare a Scribd company logo
Load testing made easy
Stéphane Landelle @ eBusiness Information
@slandelle
"
GUI" - Code (Scala)
"
1user=1thread" - Actor model
"
Blocking I/O
 - Non blocking I/O
Scenario scripts"
Write Scala code…
val scn = scenario("Scala.Io DoS")
.repeat(10000) {
exec(http("Scala.Io").get("http://scala.io"))
}
setUp(
scn.inject(rampUsers(10000) over 30 seconds)
)
… 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
… or use the Recorder
Orchestration"
Actors
Scenario = Actor Workflow
Start
Actor

Http Request
Actor

Session

Repeat
Actor

End
Actor

Async Handler
Actor
Scenario = Actor Workflow
Start
Actor

Repeat
Actor

End
Actor

Session

Http Request
Actor

Async Handler
Actor
Scenario = Actor Workflow
Start
Actor

Repeat
Actor

End
Actor

Session

Http Request
Actor

Async
Handler

Async Handler
Actor
Scenario = Actor Workflow
Start
Actor

Http Request
Actor

End
Actor

Repeat
Actor

Session

Async
Handler

Async Handler
Actor
Scenario = Actor Workflow
Start
Actor

End
Actor

Repeat
Actor
Session

Http Request
Actor

Async Handler
Actor
Scenario = Actor Workflow
Start
Actor

Http Request
Actor

Session

Repeat
Actor

End
Actor

Async Handler
Actor
I/O"
NIO
Extensions"
• 
• 
• 
• 
• 

Maven Plugin	
Maven archetype (run in IDE)	
Jenkins plugin	
Graphite live reporting	
SBT plugin (WIP)
Gatling - Paris Perf User Group
Gatling 2"
•  Planned for 2014:
o  Tons of refactoring
o  Tons of new features

•  Sorry folks, we’re late:
o  Greater good: stability

•  Milestones:
o  Current M3
o  Next M4 december?
New Expression API"
Expression in Gatling 1

type Expression = Session => String
implicit def toExpression(s: String): Expression
http("Foo").get("https://www.google.fr/search?q=${term}")
Gatling 1 issues
o  What if “term” is undefined?
o  What if “term” is of wrong type?
repeat("${times}") {} // Expects Int
foreach("${seq}”) {} // Expects Seq
è Unsafe, deal with Exceptions, not generic
Validation
Validation[+T]
-  map
-  flatMap

Success[+T]
(value: T)

Failure
(message: String)
Usage: Building a request
flatMap that s**t!
buildURI(httpAttributes.urlOrURI)
.flatMap(configureQueryCookiesAndProxy)
.flatMap(configureVirtualHost)
.flatMap(configureHeaders)
.flatMap(configureRealm)
New Expression API

type Expression[T] = Session => Validation[T]
implicit def toExpression[T](s: String): Expression[T]
New Session API
val foo: Validation[T] = session("foo").validate[T]
// unsafe:
val bar: T = session("foo").as[T]
val baz: Option[T] = session("foo").asOption[T]
New Templating API"
Templating API in Gatling 1

•  (Session => String) / Expression:
o  Function
o  Implicitly compiled EL String

•  Scalate SSP
Scalate SSP
o  Can have complex logic
o  Scala compiler in the background (overhead, proper stop)
o  Own API, learning curve
o  Does play well with Session API

Why do we need this anyway?
New Templating API: the EL way
Embedded
// passing an EL String
setBody(StringBody("""{
foo: "${foo}",
bar: ${bar}
}""")
New Templating API: the EL way
External EL based text file
// passing an EL File
setBody(ELFileBody("body.txt"))

{
foo: "${foo}",
bar: ${bar}
}
New Templating API: the EL way

o  Simple
o  Limited, can’t implement complex logic
Why do we need
non-Scala templates anyway?!
We’re not in JSP world!
We have multiline Strings and macros!
String interpolation
val jsonTemplate: Expression[String] = session =>
for {
foo <- session("foo").validate[String]
bar <- session("bar").validate[Int]
} yield s"""{
foo: "$foo",
bar: $bar
}"""
String interpolation
o  Pure Scala
o  Compile time, not runtime
o  Standard Scala library
o  Requires a bit more Scala skills
o  Complex logic => intermediate String concatenations
Fastring
https://github.com/Atry/fastring

•  StringBuilder underneath
•  Produces Fastrings, not Strings
Fastring
val jsonTemplate: Expression[String] = session =>
for (foos <- session("foos").validate[Seq[String]]) yield
fast"""{
foos = [
${foos.map(foo => fast"""{foo: "$foo"}""").mkFastring("n")}
]
}""".toString
Checks
improvements
Regex check in Gatling 1

regex("foo(.*)bar").saveAs("baz")

è produces Strings
è no more than 1 capture group
Issue
<form>
<input type="hidden" name="foo" value="foo" />
<input type="hidden" name="bar" value="baz" />
</form>
è workaround: 2 regex + manual zip
Tuple support
We need:
String
(String, String)
(String, String, String)
(String, String, String, String)
…
But generic, please…
Type class FTW
regex[T](pattern: Expression[String])
(implicit groupExtractor: GroupExtractor[T])
object GroupExtractor {
implicit val groupExtractor2:
GroupExtractor[(String, String)] = ???
}
trait GroupExtractor
regex[(String, String)]("foo(.*)bar(.*)baz")
Also for

•  headerRegex[T]
T of String, Tuple2[String] , Tuple3[String]…

•  jsonPath[T]
T of Int, Long, Double, Float, String, List, Map

•  XPath?
•  CSS selectors?
Resource fetching"
"
Gatling 1
HTML
page

Resource
1

Resource
2

Sequential workflow

Resource
3
Not how browsers work
Resource
1

HTML
page

Resource
2
Resource
3

Parallel workflow
Very complex actually
1. Fetch HTML
2. Fetch HTML embedded resources
3. Fetch some additional resources (CSS @import)
4. Fetch matching CSS rules resources (@font-face,
background-image)
5. …
(not accounting for javascript)
è Can’t be perfect without being a browser
è Will have to approximate
Kind of scatter-gather pattern
Fetch
resources

HTML
page

Session
+ HTML

Resource
Fetcher
Actor

New
Session

Beware of Session reconciliation!

Next
DSL
exec(
http(“Page").get("http://foo.com")
.resources(
http(“Ajax1").get("http://foo.com/ajax1"),
http(“Ajax2").get("http://foo.com/ajax2")
.check(regex("foo(.*)bar").saveAs("baz"))
)
)
Gatling - Paris Perf User Group
http://gatling-tool.org	
http://github.com/excilys/gatling	
@GatlingTool

More Related Content

PDF
LINQ Inside
jeffz
 
PDF
Why scala is not my ideal language and what I can do with this
Ruslan Shevchenko
 
PPT
ECMAScript 6: A Better JavaScript for the Ambient Computing Era
Allen Wirfs-Brock
 
PPTX
Kotlin
Rory Preddy
 
PPTX
Why TypeScript?
FITC
 
PPTX
Javascript asynchronous
kang taehun
 
PDF
ECMAScript 6
偉格 高
 
PPTX
Kotlin on android
Kurt Renzo Acosta
 
LINQ Inside
jeffz
 
Why scala is not my ideal language and what I can do with this
Ruslan Shevchenko
 
ECMAScript 6: A Better JavaScript for the Ambient Computing Era
Allen Wirfs-Brock
 
Kotlin
Rory Preddy
 
Why TypeScript?
FITC
 
Javascript asynchronous
kang taehun
 
ECMAScript 6
偉格 高
 
Kotlin on android
Kurt Renzo Acosta
 

What's hot (20)

PDF
JVMLS 2016. Coroutines in Kotlin
Andrey Breslav
 
PDF
Swift and Kotlin Presentation
Andrzej Sitek
 
PDF
A Lifecycle Of Code Under Test by Robert Fornal
QA or the Highway
 
PDF
Perl 5.10
acme
 
PDF
The algebra of library design
Leonardo Borges
 
PDF
使用.NET构建轻量级分布式框架
jeffz
 
PDF
Functional Reactive Programming in Clojurescript
Leonardo Borges
 
PDF
TypeScript Introduction
Dmitry Sheiko
 
PDF
Scala in Practice
Francesco Usai
 
PDF
Kotlin - Better Java
Dariusz Lorenc
 
PPTX
Doctrine 2.0 Enterprise Persistence Layer for PHP
Guilherme Blanco
 
ODP
Supercharging reflective libraries with InvokeDynamic
Ian Robertson
 
PDF
Elixir and Phoenix for Rubyists
Brooklyn Zelenka
 
PPTX
Code generation with javac plugin
Oleksandr Radchykov
 
PDF
Swift in SwiftUI
Bongwon Lee
 
PDF
Kotlin fundamentals - By: Ipan Ardian
Rizal Khilman
 
PPTX
5 Tips for Better JavaScript
Todd Anglin
 
PDF
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
Nick Sieger
 
PDF
Effective Scala (SoftShake 2013)
mircodotta
 
PPTX
C to perl binding
Shmuel Fomberg
 
JVMLS 2016. Coroutines in Kotlin
Andrey Breslav
 
Swift and Kotlin Presentation
Andrzej Sitek
 
A Lifecycle Of Code Under Test by Robert Fornal
QA or the Highway
 
Perl 5.10
acme
 
The algebra of library design
Leonardo Borges
 
使用.NET构建轻量级分布式框架
jeffz
 
Functional Reactive Programming in Clojurescript
Leonardo Borges
 
TypeScript Introduction
Dmitry Sheiko
 
Scala in Practice
Francesco Usai
 
Kotlin - Better Java
Dariusz Lorenc
 
Doctrine 2.0 Enterprise Persistence Layer for PHP
Guilherme Blanco
 
Supercharging reflective libraries with InvokeDynamic
Ian Robertson
 
Elixir and Phoenix for Rubyists
Brooklyn Zelenka
 
Code generation with javac plugin
Oleksandr Radchykov
 
Swift in SwiftUI
Bongwon Lee
 
Kotlin fundamentals - By: Ipan Ardian
Rizal Khilman
 
5 Tips for Better JavaScript
Todd Anglin
 
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
Nick Sieger
 
Effective Scala (SoftShake 2013)
mircodotta
 
C to perl binding
Shmuel Fomberg
 
Ad

Similar to Gatling - Paris Perf User Group (20)

PDF
Gatling @ Scala.Io 2013
slandelle
 
PPT
Scala
Andreas Enbohm
 
PDF
wtf is in Java/JDK/wtf7?
Scott Leberknight
 
PDF
Scala - just good for Java shops?
Sarah Mount
 
PPT
Scala in a nutshell by venkat
Venkateswaran Kandasamy
 
PDF
Don't panic in Fortaleza - ScalaFX
Alain Béarez
 
PDF
Scala in Places API
Łukasz Bałamut
 
PDF
JRuby with Java Code in Data Processing World
SATOSHI TAGOMORI
 
PPT
JS everywhere 2011
Oleg Podsechin
 
PDF
What can be done with Java, but should better be done with Erlang (@pavlobaron)
Pavlo Baron
 
PDF
Java7 New Features and Code Examples
Naresh Chintalcheru
 
PDF
Introduction to Scala : Clueda
Andreas Neumann
 
PDF
Live coding scala 'the java of the future'
Xebia Nederland BV
 
PDF
Ruby on Rails Oracle adaptera izstrāde
Raimonds Simanovskis
 
PDF
Introduction to clojure
Abbas Raza
 
PDF
sbt, history of JSON libraries, microservices, and schema evolution (Tokyo ver)
Eugene Yokota
 
PDF
Java/Spring과 Node.js의 공존 시즌2
동수 장
 
PDF
Rails on Oracle 2011
Raimonds Simanovskis
 
PDF
Diseño y Desarrollo de APIs
Raúl Neis
 
PDF
Elasticsearch And Apache Lucene For Apache Spark And MLlib
Jen Aman
 
Gatling @ Scala.Io 2013
slandelle
 
wtf is in Java/JDK/wtf7?
Scott Leberknight
 
Scala - just good for Java shops?
Sarah Mount
 
Scala in a nutshell by venkat
Venkateswaran Kandasamy
 
Don't panic in Fortaleza - ScalaFX
Alain Béarez
 
Scala in Places API
Łukasz Bałamut
 
JRuby with Java Code in Data Processing World
SATOSHI TAGOMORI
 
JS everywhere 2011
Oleg Podsechin
 
What can be done with Java, but should better be done with Erlang (@pavlobaron)
Pavlo Baron
 
Java7 New Features and Code Examples
Naresh Chintalcheru
 
Introduction to Scala : Clueda
Andreas Neumann
 
Live coding scala 'the java of the future'
Xebia Nederland BV
 
Ruby on Rails Oracle adaptera izstrāde
Raimonds Simanovskis
 
Introduction to clojure
Abbas Raza
 
sbt, history of JSON libraries, microservices, and schema evolution (Tokyo ver)
Eugene Yokota
 
Java/Spring과 Node.js의 공존 시즌2
동수 장
 
Rails on Oracle 2011
Raimonds Simanovskis
 
Diseño y Desarrollo de APIs
Raúl Neis
 
Elasticsearch And Apache Lucene For Apache Spark And MLlib
Jen Aman
 
Ad

Recently uploaded (20)

PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PDF
Doc9.....................................
SofiaCollazos
 
PPTX
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
PDF
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PPTX
Simple and concise overview about Quantum computing..pptx
mughal641
 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
PDF
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
Software Development Methodologies in 2025
KodekX
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PPTX
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
Doc9.....................................
SofiaCollazos
 
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
Simple and concise overview about Quantum computing..pptx
mughal641
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
Software Development Methodologies in 2025
KodekX
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 

Gatling - Paris Perf User Group