Gatling

All

Intro

During API development it’s very interesting/required to test the application in terms of response time for different loads. I’m using gatling for some tests here and it’s quite neat.

Apache JMeter

JMeter I’ll do a post about it later – which is not a browser, btw. I don’t know why they highlight this on the web site.

Loadrunner

Loadrunner, which Thread-based architecture, is actually from a company called Micro Focus – not opensource in fact!.

Gatling

It’s a tool to test loads since it’s based on messages, tests based on Scala – yup, not java or javascript. It overwrites the JVM limitations, therefore, so we can make much more accesses.

It uses to test http basically and the records the GUI.

Executing a performance test straight from the console.

It does not monitor back-end monitoring, as resources monitoring, like htop on the server.

 

 Class HttpSimulation1 extends Simulation {

  /* Place for arbitrary Scala code that is to be executed before the simulation begins. */

  before {

      println(“***** My simulation is about to begin! *****”)

  }

  /* Place for arbitrary Scala code that is to be executed after the simulation has ended. */

  after {

      println(“***** My simulation has ended! ******”)

  } 

  /*

   * A HTTP protocol builder is used to specify common properties of request(s) to be sent,

   * for instance the base URL, HTTP headers that are to be enclosed with all requests etc.

   */

  val theHttpProtocolBuilder = http

      .baseURL(http://computer-database.gatling.io”)

   /*

   * A scenario consists of one or more requests. For instance logging into a e-commerce

   * website, placing an order and then logging out.

   * One simulation can contain many scenarios.

   */

  /* Scenario1 is a name that describes the scenario. */

  val theScenarioBuilder = scenario(“Scenario1”)

      .exec(

          /* myRequest1 is a name that describes the request. */

          http(“myRequest1”)

              .get(“/”)

       )

  /*

   * Define the load simulation.

   * Here we can specify how many users we want to simulate, if the number of users is to increase

   * gradually or if all the simulated users are to start sending requests at once etc.

   * We also specify the HTTP protocol builder to be used by the load simulation

   */

  setUp(

      theScenarioBuilder.inject(atOnceUsers(1))

  ).protocols(theHttpProtocolBuilder)

}

Code from Krizsan, found here

REFs

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s