SlideShare uma empresa Scribd logo
1 de 43
Baixar para ler 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

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Destaque

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
 

Destaque (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?
 

Semelhante a 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
 

Semelhante a 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
 

Último

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 

Gatling @ Scala.Io 2013