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
PDF
Why scala is not my ideal language and what I can do with this
PPT
ECMAScript 6: A Better JavaScript for the Ambient Computing Era
PPTX
Kotlin
PPTX
Why TypeScript?
PPTX
Javascript asynchronous
PDF
ECMAScript 6
PPTX
Kotlin on android
LINQ Inside
Why scala is not my ideal language and what I can do with this
ECMAScript 6: A Better JavaScript for the Ambient Computing Era
Kotlin
Why TypeScript?
Javascript asynchronous
ECMAScript 6
Kotlin on android

What's hot (20)

PDF
JVMLS 2016. Coroutines in Kotlin
PDF
Swift and Kotlin Presentation
PDF
A Lifecycle Of Code Under Test by Robert Fornal
PDF
Perl 5.10
PDF
The algebra of library design
PDF
使用.NET构建轻量级分布式框架
PDF
Functional Reactive Programming in Clojurescript
PDF
TypeScript Introduction
PDF
Scala in Practice
PDF
Kotlin - Better Java
PPTX
Doctrine 2.0 Enterprise Persistence Layer for PHP
ODP
Supercharging reflective libraries with InvokeDynamic
PDF
Elixir and Phoenix for Rubyists
PPTX
Code generation with javac plugin
PDF
Swift in SwiftUI
PDF
Kotlin fundamentals - By: Ipan Ardian
PPTX
5 Tips for Better JavaScript
PDF
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
PDF
Effective Scala (SoftShake 2013)
PPTX
C to perl binding
JVMLS 2016. Coroutines in Kotlin
Swift and Kotlin Presentation
A Lifecycle Of Code Under Test by Robert Fornal
Perl 5.10
The algebra of library design
使用.NET构建轻量级分布式框架
Functional Reactive Programming in Clojurescript
TypeScript Introduction
Scala in Practice
Kotlin - Better Java
Doctrine 2.0 Enterprise Persistence Layer for PHP
Supercharging reflective libraries with InvokeDynamic
Elixir and Phoenix for Rubyists
Code generation with javac plugin
Swift in SwiftUI
Kotlin fundamentals - By: Ipan Ardian
5 Tips for Better JavaScript
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
Effective Scala (SoftShake 2013)
C to perl binding
Ad

Similar to Gatling - Paris Perf User Group (20)

PDF
Gatling @ Scala.Io 2013
KEY
The Why and How of Scala at Twitter
PDF
Gatling - JUGL, 2012-09-13
PDF
Load testing in Zonky with Gatling
PDF
TestWorks Conf Performance testing made easy with gatling - Guillaume Corré
PPTX
Gatling Tool in Action at Devoxx 2012
PPTX
Gatling : Faites tomber la foudre sur votre serveur ! (Stéphane Landelle)
PPT
Introducing Scala to your Ruby/Java Shop : My experiences at IGN
PDF
Develop realtime web with Scala and Xitrum
ODP
Gatling - Stress test tool
PDF
Gatling Performance Workshop
ODP
How to start using Scala
PDF
Scala / Technology evolution
PDF
Scala in Places API
PDF
sbt, history of JSON libraries, microservices, and schema evolution (Tokyo ver)
PDF
Clojure & Scala
PDF
Load test REST APIs using gatling
PPTX
Tools for Making Machine Learning more Reactive
PDF
What can be done with Java, but should better be done with Erlang (@pavlobaron)
PPTX
What is scala
Gatling @ Scala.Io 2013
The Why and How of Scala at Twitter
Gatling - JUGL, 2012-09-13
Load testing in Zonky with Gatling
TestWorks Conf Performance testing made easy with gatling - Guillaume Corré
Gatling Tool in Action at Devoxx 2012
Gatling : Faites tomber la foudre sur votre serveur ! (Stéphane Landelle)
Introducing Scala to your Ruby/Java Shop : My experiences at IGN
Develop realtime web with Scala and Xitrum
Gatling - Stress test tool
Gatling Performance Workshop
How to start using Scala
Scala / Technology evolution
Scala in Places API
sbt, history of JSON libraries, microservices, and schema evolution (Tokyo ver)
Clojure & Scala
Load test REST APIs using gatling
Tools for Making Machine Learning more Reactive
What can be done with Java, but should better be done with Erlang (@pavlobaron)
What is scala
Ad

Recently uploaded (20)

PPTX
Microsoft Excel 365/2024 Beginner's training
PDF
CloudStack 4.21: First Look Webinar slides
PDF
sbt 2.0: go big (Scala Days 2025 edition)
PDF
A review of recent deep learning applications in wood surface defect identifi...
PDF
Architecture types and enterprise applications.pdf
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
The influence of sentiment analysis in enhancing early warning system model f...
PDF
Two-dimensional Klein-Gordon and Sine-Gordon numerical solutions based on dee...
PPT
Geologic Time for studying geology for geologist
PDF
Credit Without Borders: AI and Financial Inclusion in Bangladesh
PDF
Convolutional neural network based encoder-decoder for efficient real-time ob...
PDF
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
PDF
Getting started with AI Agents and Multi-Agent Systems
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
STKI Israel Market Study 2025 version august
DOCX
search engine optimization ppt fir known well about this
PPT
Module 1.ppt Iot fundamentals and Architecture
PPT
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
Microsoft Excel 365/2024 Beginner's training
CloudStack 4.21: First Look Webinar slides
sbt 2.0: go big (Scala Days 2025 edition)
A review of recent deep learning applications in wood surface defect identifi...
Architecture types and enterprise applications.pdf
Final SEM Unit 1 for mit wpu at pune .pptx
Zenith AI: Advanced Artificial Intelligence
The influence of sentiment analysis in enhancing early warning system model f...
Two-dimensional Klein-Gordon and Sine-Gordon numerical solutions based on dee...
Geologic Time for studying geology for geologist
Credit Without Borders: AI and Financial Inclusion in Bangladesh
Convolutional neural network based encoder-decoder for efficient real-time ob...
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
Getting started with AI Agents and Multi-Agent Systems
A contest of sentiment analysis: k-nearest neighbor versus neural network
Hindi spoken digit analysis for native and non-native speakers
STKI Israel Market Study 2025 version august
search engine optimization ppt fir known well about this
Module 1.ppt Iot fundamentals and Architecture
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...

Gatling - Paris Perf User Group