DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

SBOMs are essential to circumventing software supply chain attacks, and they provide visibility into various software components.

Related

  • Load Testing Essentials for High-Traffic Applications
  • Queuing Theory for Non-Functional Testing
  • Automated Testing in Data Engineering: An Imperative for Quality and Efficiency
  • Navigating Challenges in Online Banking API Testing

Trending

  • Designing Microservices Architecture With a Custom Spring Boot Starter and Auto-Configuration Framework
  • Why Tailwind CSS Can Be Used Instead of Bootstrap CSS
  • Modernizing Apache Spark Applications With GenAI: Migrating From Java to Scala
  • The Battle of the Frameworks: Choosing the Right Tech Stack
  1. DZone
  2. Software Design and Architecture
  3. Performance
  4. Gatling: A Lightweight Load Testing Tool

Gatling: A Lightweight Load Testing Tool

Gatling consumes fewer system resources to run a load test than other options. It works asynchronously if the underlying HTTP request is nonblocking.

By 
Siva Prasad Rao Janapati user avatar
Siva Prasad Rao Janapati
·
Feb. 01, 17 · Opinion
Likes (3)
Comment
Save
Tweet
Share
5.9K Views

Join the DZone community and get the full member experience.

Join For Free

Gatling is a lightweight stress testing tool backed by Scala, Akka, and Netty. It works asynchronously if the underlying HTTP request is nonblocking. It uses messages for virtual user simulation than threads per virtual user. Because of this, it consumes fewer system resources to run a load test. In this article, let's see a REST endpoint load test by following the below steps.

1. Download the Gatling Bundle

You can download this from Gatling. The folder structure of GATLING_HOME is explained below.

gatling_folder_structure

2. Set Environment Variables

Set GATLING_HOME and JAVA_HOME environment variables and write a sample simulation using Scala. As a Java developer, you don't need to have strong Scala knowledge to write Gatling simulations with Scala. We need to have very basic knowledge. A simulation is given below to test a REST endpoint.

package org.smarttechie

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._

class SampleRESTEndPointPrefSimulation extends Simulation {

val httpProtocol = http
.baseURL("<base url of your end point>") //the base url of your end point
val restEndPoint = "/posts" //provide the URI of your end point

val restEndpointScenario = scenario("Posts_Pref_Simulation")
.exec(http("request_1")
.get(restEndPoint))
setUp(restEndpointScenario.inject(rampUsers(1000) over (10 seconds))).protocols(httpProtocol)
}

In the above simulation, we are ramping up 1,000 users in 10 seconds. Once the simulation script is ready, go to the BIN folder and launch the gatling.bat/gatling.sh. The script will run the simulation available under the simulations folder and generates the reports under results folder.

The sample report is given below.

gatling_performance_stats

In the coming article, we will see how to use Gatling Maven integration and additional features like feeders, how to externalize the properties, etc. Until then, stay tuned!

Gatling (software) Load testing

Published at DZone with permission of Siva Prasad Rao Janapati, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Load Testing Essentials for High-Traffic Applications
  • Queuing Theory for Non-Functional Testing
  • Automated Testing in Data Engineering: An Imperative for Quality and Efficiency
  • Navigating Challenges in Online Banking API Testing

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • [email protected]

Let's be friends: