SlideShare a Scribd company logo
1 of 43
Download to read offline
Gatling 2,
What’s up Doc?
by Stéphane Landelle @slandelle
Quick Introduction / Reminder
about
What’s Gatling?

•  Stress Test Tool
•  Scala + Akka +Netty
•  Scenarios = code + DSL
Scenario
val scn = scenario("Scala.Io DoS")
.repeat(10000) {
exec(http("Scala.Io").get("http://scala.io"))
}
setUp(
scn.inject(rampUsers(10000) over 30 seconds)
)
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
Timeline

•  Mid 2011:
o  Start developing Gatling
o  No Scala background

•  End 2012:
o  Better Scala skills
o  Community feedback
o  Need for open APIs

Time to clean this up!
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 november/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"))
)
)
And many more to come…
Q/A?
@GatlingTool
http://gatling-tool.org
https://github.com/excilys/gatling

More Related Content

What's hot

Salesforce Batch processing - Atlanta SFUG
Salesforce Batch processing - Atlanta SFUGSalesforce Batch processing - Atlanta SFUG
Salesforce Batch processing - Atlanta SFUG
vraopolisetti
 
Using Apache Camel connectors for external connectivity
Using Apache Camel connectors for external connectivityUsing Apache Camel connectors for external connectivity
Using Apache Camel connectors for external connectivity
Claus Ibsen
 
End to-end async and await
End to-end async and awaitEnd to-end async and await
End to-end async and await
vfabro
 

What's hot (20)

Celery introduction
Celery introductionCelery introduction
Celery introduction
 
Reactive programming with Rxjava
Reactive programming with RxjavaReactive programming with Rxjava
Reactive programming with Rxjava
 
JavaCro'14 - Is there Kotlin after Java 8 – Ivan Turčinović and Igor Buzatović
JavaCro'14 - Is there Kotlin after Java 8 – Ivan Turčinović and Igor BuzatovićJavaCro'14 - Is there Kotlin after Java 8 – Ivan Turčinović and Igor Buzatović
JavaCro'14 - Is there Kotlin after Java 8 – Ivan Turčinović and Igor Buzatović
 
Async and Await on the Server
Async and Await on the ServerAsync and Await on the Server
Async and Await on the Server
 
Reactive Programming in Java 8 with Rx-Java
Reactive Programming in Java 8 with Rx-JavaReactive Programming in Java 8 with Rx-Java
Reactive Programming in Java 8 with Rx-Java
 
Salesforce Batch processing - Atlanta SFUG
Salesforce Batch processing - Atlanta SFUGSalesforce Batch processing - Atlanta SFUG
Salesforce Batch processing - Atlanta SFUG
 
Performance measurement methodology — Maksym Pugach | Elixir Evening Club 3
Performance measurement methodology — Maksym Pugach | Elixir Evening Club 3Performance measurement methodology — Maksym Pugach | Elixir Evening Club 3
Performance measurement methodology — Maksym Pugach | Elixir Evening Club 3
 
Learn ELK in docker
Learn ELK in dockerLearn ELK in docker
Learn ELK in docker
 
Gobblin on-aws
Gobblin on-awsGobblin on-aws
Gobblin on-aws
 
Apache Camel Introduction & What's in the box
Apache Camel Introduction & What's in the boxApache Camel Introduction & What's in the box
Apache Camel Introduction & What's in the box
 
Javantura v3 - ES6 – Future Is Now – Nenad Pečanac
Javantura v3 - ES6 – Future Is Now – Nenad PečanacJavantura v3 - ES6 – Future Is Now – Nenad Pečanac
Javantura v3 - ES6 – Future Is Now – Nenad Pečanac
 
Using Apache Camel connectors for external connectivity
Using Apache Camel connectors for external connectivityUsing Apache Camel connectors for external connectivity
Using Apache Camel connectors for external connectivity
 
Developing Java based microservices ready for the world of containers
Developing Java based microservices ready for the world of containersDeveloping Java based microservices ready for the world of containers
Developing Java based microservices ready for the world of containers
 
Shipping & Visualize Your Data With ELK
Shipping  & Visualize Your Data With ELKShipping  & Visualize Your Data With ELK
Shipping & Visualize Your Data With ELK
 
Developer-friendly taskqueues: What you should ask yourself before choosing one
Developer-friendly taskqueues: What you should ask yourself before choosing oneDeveloper-friendly taskqueues: What you should ask yourself before choosing one
Developer-friendly taskqueues: What you should ask yourself before choosing one
 
Developing Java based microservices ready for the world of containers
Developing Java based microservices ready for the world of containersDeveloping Java based microservices ready for the world of containers
Developing Java based microservices ready for the world of containers
 
Drilling the Async Library
Drilling the Async LibraryDrilling the Async Library
Drilling the Async Library
 
Reflection in Pharo: Beyond Smalltak
Reflection in Pharo: Beyond SmalltakReflection in Pharo: Beyond Smalltak
Reflection in Pharo: Beyond Smalltak
 
End to-end async and await
End to-end async and awaitEnd to-end async and await
End to-end async and await
 
Flask & Flask-restx
Flask & Flask-restxFlask & Flask-restx
Flask & Flask-restx
 

Viewers also liked

Load testing with gatling
Load testing with gatlingLoad testing with gatling
Load testing with gatling
Chris Birchall
 
Continuous validation of load test suites
Continuous validation of load test suitesContinuous validation of load test suites
Continuous validation of load test suites
SAIL_QU
 
Hands On, Duchess 10/17/2012
Hands On, Duchess 10/17/2012Hands On, Duchess 10/17/2012
Hands On, Duchess 10/17/2012
slandelle
 
Blast your app with Gatling! by Stephane Landelle
Blast your app with Gatling! by Stephane LandelleBlast your app with Gatling! by Stephane Landelle
Blast your app with Gatling! by Stephane Landelle
ZeroTurnaround
 

Viewers also liked (17)

Load testing with gatling
Load testing with gatlingLoad testing with gatling
Load testing with gatling
 
Performance Test Automation With Gatling
Performance Test Automation  With GatlingPerformance Test Automation  With Gatling
Performance Test Automation With Gatling
 
20150605 영남대 특강_변민우
20150605 영남대 특강_변민우20150605 영남대 특강_변민우
20150605 영남대 특강_변민우
 
Continuous validation of load test suites
Continuous validation of load test suitesContinuous validation of load test suites
Continuous validation of load test suites
 
Continuous performance: Load testing for developers with gatling @ JavaOne 2016
Continuous performance: Load testing for developers with gatling @ JavaOne 2016Continuous performance: Load testing for developers with gatling @ JavaOne 2016
Continuous performance: Load testing for developers with gatling @ JavaOne 2016
 
Gatling - oružje u redovima performansnog testiranja
Gatling - oružje u redovima performansnog testiranjaGatling - oružje u redovima performansnog testiranja
Gatling - oružje u redovima performansnog testiranja
 
STARWest: Use Jenkins For Continuous 
Load Testing And Mobile Test Automation
STARWest: Use Jenkins For Continuous 
Load Testing And Mobile Test AutomationSTARWest: Use Jenkins For Continuous 
Load Testing And Mobile Test Automation
STARWest: Use Jenkins For Continuous 
Load Testing And Mobile Test Automation
 
Hands On, Duchess 10/17/2012
Hands On, Duchess 10/17/2012Hands On, Duchess 10/17/2012
Hands On, Duchess 10/17/2012
 
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
 
Blast your app with Gatling! by Stephane Landelle
Blast your app with Gatling! by Stephane LandelleBlast your app with Gatling! by Stephane Landelle
Blast your app with Gatling! by Stephane Landelle
 
Skinny Framework 1.0.0
Skinny Framework 1.0.0Skinny Framework 1.0.0
Skinny Framework 1.0.0
 
Performance Testing using Real Browsers with JMeter & Webdriver
Performance Testing using Real Browsers with JMeter & WebdriverPerformance Testing using Real Browsers with JMeter & Webdriver
Performance Testing using Real Browsers with JMeter & Webdriver
 
How Slow Load Times Hurt Your Bottom Line (And 17 Things You Can Do to Fix It)
How Slow Load Times Hurt Your Bottom Line (And 17 Things You Can Do to Fix It)How Slow Load Times Hurt Your Bottom Line (And 17 Things You Can Do to Fix It)
How Slow Load Times Hurt Your Bottom Line (And 17 Things You Can Do to Fix It)
 
JMeter Database Performace Testing - Keytorc Approach
JMeter Database Performace Testing - Keytorc ApproachJMeter Database Performace Testing - Keytorc Approach
JMeter Database Performace Testing - Keytorc Approach
 
오픈 소스 도구를 활용한 성능 테스트 방법 및 사례
오픈 소스 도구를 활용한 성능 테스트 방법 및 사례오픈 소스 도구를 활용한 성능 테스트 방법 및 사례
오픈 소스 도구를 활용한 성능 테스트 방법 및 사례
 
Docker and Go: why did we decide to write Docker in Go?
Docker and Go: why did we decide to write Docker in Go?Docker and Go: why did we decide to write Docker in Go?
Docker and Go: why did we decide to write Docker in Go?
 
Speed matters, So why is your site so slow?
Speed matters, So why is your site so slow?Speed matters, So why is your site so slow?
Speed matters, So why is your site so slow?
 

Similar to Gatling @ Scala.Io 2013

Building Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with ScalaBuilding Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with Scala
WO Community
 
Nexthink Library - replacing a ruby on rails application with Scala and Spray
Nexthink Library - replacing a ruby on rails application with Scala and SprayNexthink Library - replacing a ruby on rails application with Scala and Spray
Nexthink Library - replacing a ruby on rails application with Scala and Spray
Matthew Farwell
 

Similar to Gatling @ Scala.Io 2013 (20)

Gatling - Paris Perf User Group
Gatling - Paris Perf User GroupGatling - Paris Perf User Group
Gatling - Paris Perf User Group
 
Scala - just good for Java shops?
Scala - just good for Java shops?Scala - just good for Java shops?
Scala - just good for Java shops?
 
Scala
ScalaScala
Scala
 
Don't panic in Fortaleza - ScalaFX
Don't panic in Fortaleza - ScalaFXDon't panic in Fortaleza - ScalaFX
Don't panic in Fortaleza - ScalaFX
 
Scala in a nutshell by venkat
Scala in a nutshell by venkatScala in a nutshell by venkat
Scala in a nutshell by venkat
 
Java 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevJava 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from Oredev
 
wtf is in Java/JDK/wtf7?
wtf is in Java/JDK/wtf7?wtf is in Java/JDK/wtf7?
wtf is in Java/JDK/wtf7?
 
Building Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with ScalaBuilding Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with Scala
 
Scala in Places API
Scala in Places APIScala in Places API
Scala in Places API
 
JS everywhere 2011
JS everywhere 2011JS everywhere 2011
JS everywhere 2011
 
4 JVM Web Frameworks
4 JVM Web Frameworks4 JVM Web Frameworks
4 JVM Web Frameworks
 
Java7 New Features and Code Examples
Java7 New Features and Code ExamplesJava7 New Features and Code Examples
Java7 New Features and Code Examples
 
What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)
 
Scala uma poderosa linguagem para a jvm
Scala   uma poderosa linguagem para a jvmScala   uma poderosa linguagem para a jvm
Scala uma poderosa linguagem para a jvm
 
JSLT: JSON querying and transformation
JSLT: JSON querying and transformationJSLT: JSON querying and transformation
JSLT: JSON querying and transformation
 
Introduction to clojure
Introduction to clojureIntroduction to clojure
Introduction to clojure
 
あなたのScalaを爆速にする7つの方法
あなたのScalaを爆速にする7つの方法あなたのScalaを爆速にする7つの方法
あなたのScalaを爆速にする7つの方法
 
Nexthink Library - replacing a ruby on rails application with Scala and Spray
Nexthink Library - replacing a ruby on rails application with Scala and SprayNexthink Library - replacing a ruby on rails application with Scala and Spray
Nexthink Library - replacing a ruby on rails application with Scala and Spray
 
Scala final ppt vinay
Scala final ppt vinayScala final ppt vinay
Scala final ppt vinay
 
Dallas Scala Meetup
Dallas Scala MeetupDallas Scala Meetup
Dallas Scala Meetup
 

Recently uploaded

Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
UXDXConf
 

Recently uploaded (20)

Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 
Connecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKConnecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAK
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024
 
AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 
The UX of Automation by AJ King, Senior UX Researcher, Ocado
The UX of Automation by AJ King, Senior UX Researcher, OcadoThe UX of Automation by AJ King, Senior UX Researcher, Ocado
The UX of Automation by AJ King, Senior UX Researcher, Ocado
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
THE BEST IPTV in GERMANY for 2024: IPTVreel
THE BEST IPTV in  GERMANY for 2024: IPTVreelTHE BEST IPTV in  GERMANY for 2024: IPTVreel
THE BEST IPTV in GERMANY for 2024: IPTVreel
 

Gatling @ Scala.Io 2013