Responsive

Distributed Load Testing with Gatling and Testkube on Kubernetes

Published
July 20, 2025
Bruno Lopes
Product Leader
Testkube

Table of Contents

Unlock Better Testing Workflows in Kubernetes — Try Testkube for Free

Subscribe to our monthly newsletter to stay up to date with all-things Testkube.

You have successfully subscribed to the Testkube newsletter.
You have successfully subscribed to the Testkube newsletter.
Oops! Something went wrong while submitting the form.
Last updated
July 19, 2025
Bruno Lopes
Product Leader
Testkube
Share on X
Share on LinkedIn
Share on Reddit
Share on HackerNews
Copy URL

Table of Contents

Distributed Load Testing TL;DR

TL;DR

Distributed Load Testing with Gatling & Testkube

  • 1
    Distributed load testing is essential for modern microservices applications that experience varying loads - it uses multiple machines to simulate realistic user behavior and identify bottlenecks more accurately than single-machine testing
  • 2
    Gatling is a powerful load testing tool that supports distributed testing across multiple nodes, allowing you to simulate traffic from different geographical locations and scale to handle large numbers of concurrent users
  • 3
    Key challenges include resource limitations, complex configuration requirements, result aggregation difficulties, and infrastructure management complexity when coordinating tests across multiple machines
  • 4
    Testkube integration simplifies distributed Gatling tests by leveraging Kubernetes to manage test workflows, automatically distribute tests across nodes, and provide centralized monitoring and result aggregation through a unified UI
  • 5
    Implementation involves creating test workflows with configurable parameters (duration, virtual users, workers), running tests in parallel across multiple workers, and collecting artifacts/reports from each node for comprehensive performance analysis

Today's applications differ from those of a few years ago. Most applications are becoming more complex as they migrate to a microservices-based design. Consider an e-commerce platform with microservices for order tracking, payments, and other functions. The load experienced by such applications changes significantly depending on the time of day, shopping sales, and festivals. Therefore, keeping the application up and functioning during such periods is important.

Consequently, load tests are crucial for validating your apps' stability and availability. Distributed load testing is further used to replicate complex real-world situations.

In the first article in this series, we walked through how to set up a simple Gatling load test with Testkube. In this blog post, we will explore the requirements for distributed load testing, the challenges associated with it, and a detailed guide on implementing Gatling distributed load testing with Testkube. 

Need For Distributed Load Testing

In certain situations, such as simulating large numbers of users or traffic from multiple geographical locations, it is necessary to use a distributed approach. A distributed testing approach involves running load tests across multiple machines to simulate realistic user behavior and push the application to its limits. Some of the benefits include:

  • Relevant Traffic Simulation: Tests can more accurately indicate user behavior by simulating traffic from various IP addresses and geographical locations.
  • Scalability: Load tests must scale with the applications. Distributed testing facilitates the simulation of a greater number of concurrent users.
  • Bottleneck Identification: By distributing the load, you can identify specific bottlenecks in your infrastructure, resulting in more accurate optimizations.
  • Distributed Testing: Gatling supports distributed load testing, which lets you replicate traffic from various locations to test applications with users from different locations.

Distributed Load Testing with Gatling

Gatling is a load testing solution tailored to analyze and assess the performance of web applications under various load conditions. Distributed load testing analyzes how an application operates under huge user loads by simulating concurrent traffic across multiple machines or nodes.

When using a distributed setup approach, Gatling manages the execution of test scripts on several nodes, each adding to the total load on the intended application. This not only improves test scalability but also allows for more accurate detection of performance bottlenecks.

Source

In addition to replicating real-world activity, Gatling can help identify possible bottlenecks and performance issues, allowing you to resolve them before they adversely impact users.
Gatling can run as a standalone tool and even supports integration with various build tools, such as Gradle and Maven, and CI/CD tools, like GitLab and Jenkins.

Refer to the Gatling documentation for more information.

Challenges of Distributed Gatling Tests

While Gatling is powerful, distributed load testing introduces complexities that require attention:

  • Resource Limitation: Even with distributed testing, the testing infrastructure's hardware resources limit the process. This can make it challenging to replicate large numbers of concurrent users. 
  • Complex Configuration: Setting up distributed tests necessitates careful configuration of test scripts and infrastructure. Static test configurations lack flexibility, making adapting to many production-like scenarios difficult.
  • Aggregation of Results: Combining results from multiple machines can be complex and error-prone. To obtain reliable test results, it is important to combine data from all nodes correctly.
  • Infrastructure Management: Managing the infrastructure for distributed testing, such as synchronizing multiple machines and deploying tests across them, adds another level of complexity to the testing process. 

Distributed Load Testing with Testkube And Gatling

Testkube enhances distributed load testing by integrating seamlessly with Kubernetes, allowing you to create comprehensive test workflows with different processes. Working with Testkube is as simple as integrating a load testing tool like Gatling and configuring Test Workflows to manage and execute tests across multiple nodes efficiently. 

Testkube distributes these tests to replicate real-world traffic, allocating resources through its job scheduler. Following the tests, Testkube aggregates the results from all nodes, providing a centralized UI for monitoring and analyzing logs, performance metrics, and test artifacts, ensuring a thorough evaluation of the application's performance under load.

We’ll now look at creating a simple Gatling test workflow using Gradle in Testkube. The test code and related files are in our Gatling Test repository

For a visual walkthrough of this tutorial, you can watch the accompanying video below before diving into the written instructions and prerequisites.

Prerequisites

Once the prerequisites are met, you can launch a target Kubernetes cluster with a configured Testkube agent.

Creating a Test Workflow

Navigate to the test workflow section and click the “Add New Test Workflow” button. 


A “Create a Test Workflow” dialog provides four options to create a test workflow:

  • Create from Wizard: This option displays a dialog box that guides you through the steps of creating a new test workflow. 
  • Start from an Example: This option allows you to use a pre-configured example, such as k6, Playwright, Cypress, Playwright, or Postman.
  • Combine Existing Workflows: This option allows you to combine and run various existing test workflows sequentially or simultaneously.
  • Import a Workflow from YAML: This option allows you to import a test workflow using a YAML definition.

Create this workflow by choosing the “Start from an example” option.

We’ll choose “Gradle” to create this test workflow for Gatling. As mentioned in the test, we're using a customized Test workflow as shown in test.yaml file. We shall discuss the content of this spec later in this blog post.

Click on the “Create & Run” button to create and run the test workflow.

Executing Test Workflow

Because this is a distributed test workflow, you will be asked to provide values for the duration, number of workers, and virtual users before executing the test workflow. 

  

Enter the parameter values for duration and the number of virtual users and workers. If you don’t provide anything, it will choose the default values mentioned in the spec file.

Once these parameters are set, click ”Run” to start the load test with the configured settings. The Test Workflow will start executing based on the parameter values that you have provided.

Based on the number of workers provided, you can see that Gatling load tests run simultaneously on that many workers. To view more information about each execution, simply click on any of the workers.

Navigate to the "Artifacts" page to view the test logs and reports. Logs and reports are generated for each worker.

Clicking on any of the reports will open them in a new tab. Below is what a typical distributed load test report looks like.

This was a simple demonstration of creating and running Gatling distributed load tests with Testkube. To get the most out of test workflows, create custom workflows and import them into Testkube. 

Read our blog post on running distributed Gatling tests on Testkube to perform large-scale distributed load tests

Understanding Gatling Test Workflow File

Let’s understand the Gatling Test Workflow used for configuring and executing this test:

kind:TestWorkflow
apiVersion: testworkflows.testkube.io/v1
metadata:
  name: gatling-testkube-distributed
  namespace: testkube
  labels:
    docs: example
spec:
  config:
    duration:
      type: string
      default: 5s
    vus:
      type: integer
      default: 10
    workers:
      type: integer
      default: 3
  content:
    git:
      uri: https://github.com/kubeshop/testkube-examples.git
      revision: main
      paths:
      - Gradle/Gatling/Distributed
  container:
    env:
    - name: vus
      value: '{{config.vus}}'
    - name: duration
      value: '{{config.duration}}'
  steps:
  - name: Run test
    parallel:
      count: config.workers
      transfer:
      - from: /data/repo/Gradle/Gatling/Distributed
      use:
      - name: distribute/evenly
      container:
        workingDir: /data/repo/Gradle/Gatling/Distributed
        resources:
          requests:
            cpu: 128m
            memory: 128Mi
      paused: true
      run:
        image: gradle
        shell: |
          ./gradlew gatlingRun
      artifacts:
        workingDir: /data/repo/Gradle/Gatling/Distributed/build/reports/
        paths:
        - '**/*'
status: {}

In the above file:

  • The configuration specs specify the number of workers, virtual users, and duration of the test.
  • The test source is a file from a GitHub repository. Refer to the distributed load test YAML spec file referenced in this specification.
  • Resource restrictions for CPU and RAM and image details are provided.
  • The test execution command, as well as the artifact settings for log collection, are provided.

Read our test workflow document to understand more about the test workflow specification.

Summary

This article highlights the importance of distributed load testing and presents Gatling as an effective tool to evaluate an application's ability to withstand real-world traffic demands. Without a doubt, we can say that load testing is essential for evaluating the application's resilience. Distributed load testing provides a more realistic, production-like environment, and tools such as Gatling simplify the process significantly.

Get started with Testkube today, or check out the Testkube documentation to learn more about running distributed tests in Testkube with other testing tools. If you find yourself struggling with anything, feel free to drop a note in our active Slack community, and someone will help you out.

Top 5 Gatling Distributed Load Testing FAQs

Gatling Distributed Load Testing FAQs

Essential questions about distributed performance testing with Gatling

Distributed load testing involves running performance tests across multiple machines or nodes to simulate high traffic and real-world usage conditions. This approach allows you to generate significantly more load than a single machine could produce while creating more realistic test scenarios.

Key benefits of distributed load testing include:

  • Scalable load generation: Overcome hardware limitations by distributing load across multiple machines
  • Bottleneck identification: Discover performance issues that only emerge under high concurrent load
  • Realistic traffic simulation: Simulate traffic from different geographical locations and network conditions
  • Infrastructure validation: Test the entire system's ability to handle peak loads
  • Reliability assurance: Ensure applications maintain stability under sustained high traffic

Distributed testing is crucial for applications expecting high traffic volumes, as it reveals performance characteristics that single-node testing cannot uncover.

Gatling supports distributed load testing by enabling the execution of test scripts across multiple nodes, with each node contributing to the overall load simulation:

  • Multi-node execution: Deploy identical test scripts across multiple Gatling instances running on separate machines or containers
  • Load distribution: Each node simulates a portion of the total virtual users, distributing the computational load
  • Synchronized testing: Coordinate test execution across nodes for consistent timing and realistic traffic patterns
  • Aggregated reporting: Combine results from all nodes to provide comprehensive performance metrics
  • Resource optimization: Leverage multiple CPUs and memory pools for higher concurrent user simulation

Gatling's distributed approach offers:

  • Higher throughput capabilities beyond single-machine limits
  • More accurate stress simulations for enterprise applications
  • Better identification of infrastructure bottlenecks and limitations
  • Realistic load patterns that mirror production traffic distribution

Running distributed Gatling tests introduces several technical and operational challenges that require careful planning and management:

  • Resource management across nodes:
    • Ensuring consistent CPU and memory allocation
    • Managing network bandwidth limitations
    • Monitoring resource utilization across all test nodes
  • Environment consistency:
    • Maintaining identical test configurations across nodes
    • Synchronizing test data and dependencies
    • Managing different network latencies and conditions
  • Results aggregation and analysis:
    • Collecting and merging results from multiple machines
    • Handling timing synchronization issues
    • Correlating metrics across distributed execution
  • Test orchestration infrastructure:
    • Coordinating test start and stop times
    • Managing failures and recovery scenarios
    • Scaling test infrastructure dynamically

These challenges require robust tooling and processes to ensure reliable and meaningful distributed test execution.

Running distributed Gatling tests in Kubernetes leverages container orchestration for scalable and manageable test execution:

  • Test orchestration with Testkube:
    • Use Testkube as a Kubernetes-native testing framework
    • Manage distribution of load tests across multiple pods automatically
    • Centralized UI for monitoring and managing distributed test execution
  • Pod-based distribution:
    • Deploy Gatling as containerized workloads across cluster nodes
    • Each pod runs a portion of the total virtual users
    • Kubernetes handles pod scheduling and resource allocation
  • Artifact and results collection:
    • Automated collection of test results from all pods
    • Centralized storage using persistent volumes or object storage
    • Integration with monitoring and observability tools
  • Configuration management:
    • Use ConfigMaps for test scripts and parameters
    • Secrets for sensitive configuration data
    • Helm charts for repeatable deployment patterns

This approach provides scalable, automated, and observable distributed load testing that integrates seamlessly with cloud-native development workflows.

Configuring distributed Gatling test workflows requires careful parameter tuning to ensure effective load distribution and accurate results:

  • Virtual Users (vus):
    • Total number of concurrent users to simulate across all nodes
    • Automatically divided among worker nodes
    • Should align with expected production traffic patterns
  • Duration:
    • How long the test runs (e.g., 5m, 30m, 2h)
    • Include ramp-up and ramp-down periods
    • Consider steady-state duration for meaningful metrics
  • Workers:
    • Number of parallel nodes running the test
    • Balances load distribution with resource efficiency
    • Typically 2-10 workers depending on load requirements
  • Additional configuration parameters:
    • rampUpDuration: Time to gradually increase load
    • targetUrl: Application endpoint to test
    • testData: Input data files and configurations
    • resourceLimits: CPU and memory constraints per worker

These parameters are typically defined in workflow YAML files or passed at runtime in orchestrated environments like Testkube, allowing for flexible and repeatable test configurations.

About Testkube

Testkube is a test execution and orchestration framework for Kubernetes that works with any CI/CD system and testing tool you need. It empowers teams to deliver on the promise of agile, efficient, and comprehensive testing programs by leveraging all the capabilities of K8s to eliminate CI/CD bottlenecks, perfecting your testing workflow. Get started with Testkube's free trial today.