Outils pour utilisateurs

Outils du site


tech:notes_tests_de_charge_http_avec_gatling

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
tech:notes_tests_de_charge_http_avec_gatling [2025/11/11 19:54] Jean-Baptistetech:notes_tests_de_charge_http_avec_gatling [2026/06/29 14:02] (Version actuelle) Jean-Baptiste
Ligne 1: Ligne 1:
 +<!DOCTYPE markdown>
 +{{tag>Brouillon Perf Web Scala}}
 +
 +# Notes tests de charge HTTP avec Gatling
 +
 +
 +
 +Voir aussi :
 +* [[Jmeter - notes|Apache JMeter]]
 +* [Serveur Web : tests de charge en Python avec Locust](https://www.it-connect.fr/serveur-web-tests-de-charge-en-python-avec-locust/)
 +
 +
 +## Install IDE pour dev
 +
 +Voir : 
 +* https://gatling.io/open-source/gatling-demo/video-demo/?submissionGuid=efc5d076-c18a-46ae-b1ca-4669580bfd05
 +* https://www.youtube.com/watch?v=5MYuQBQZ8Ys
 +* https://github.com/gatling/gatling-tutorial
 +* [Introduction à Gatling et Scala (obsolète mais intéressant)](http://www.jpsymfony.com/outils/utilisation-de-gatling)
 +* https://www.james-willett.com/gatling-load-testing-complete-guide/
 +
 +Install IDE Scala et tous le reste (pas nécessaire)
 +~~~bash
 +apt install python-pip python3-pip snapd
 +apt-get install openjdk-11-jdk maven
 +wget https://downloads.lightbend.com/scala/2.12.2/scala-2.12.2.deb
 +dpkg -i scala-2.12.2.deb
 +
 +snap install intellij-idea-community --classic
 +~~~
 +
 +Lancement IDE
 +~~~bash
 +/snap/bin/intellij-idea-community
 +~~~
 +
 +
 +## getling recorder
 +
 +~~~bash
 +./gatling-charts-highcharts-bundle-3.6.0/bin/recorder.sh
 +~~~
 +
 +
 +## Lancement
 +
 +`simulation/plop/test1.scala`
 +~~~scala
 +package plop.hpplop.simulation.mainProfile
 +
 +import scala.concurrent.duration._
 +
 +import io.gatling.core.Predef._
 +import io.gatling.http.Predef._
 +import io.gatling.jdbc.Predef._
 +
 +class ChargeHPO extends Simulation {
 +    val durationTime = scala.util.Properties.envOrElse("DURATION", "3" )
 +    val minUsers = scala.util.Properties.envOrElse("MINUSER", "2")
 +    val maxUsers = scala.util.Properties.envOrElse("MAXUSER", "3")
 +    val baseUrl = scala.util.Properties.envOrElse("BASEURL", "")
 +    println(baseUrl.toString)
 +
 +    val httpProtocol = http.baseUrl(baseUrl.toString)
 +
 +    val headers_hpo = Map(
 +        "Host" -> "acme.fr",
 +    )
 +
 +    val scn = scenario("HP Plop")
 +        .exec(http("Root")
 +        .get("/")
 +        .disableFollowRedirect
 +        .check(status is (301))
 +        .headers(headers_hpo)
 +    )
 +
 +    setUp(
 +        scn.inject(
 +            nothingFor(10 seconds),
 +            rampUsersPerSec(minUsers.toInt) to maxUsers.toInt during (durationTime.toInt minutes)
 +        ).protocols(httpProtocol)
 +    )
 +}
 +~~~
 +
 +~~~bash
 +env BASEURL=http://acme.fr ~/code/http/gatling-charts-highcharts-bundle-3.6.0/bin/gatling.sh -sf simulations/plop/ -rd "Test1 "
 +~~~
 +
 +
 +## Pb
 +
 +Erreur avec l'IDE
 +
 +~~~
 +gatling-tutorial/src/test/scala/Engine.scala
 +object gatling is not a member of package io
 +import io.gatling.app.Gatling
 +~~~
 +
 +## Notes Scala
 +
 +Voir aussi : Kotlin
 +
 +
 +
 +
  

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki