Skip to content

Tutorials

JMeter ecosystem for your Performance test through docker-compose, monitor, and mock your services

If you'd like to carry out load tests in a simple way, benefit from a simplified configuration with a focus on writing your test plan and its test typology, have the opportunity to monitor through detailed dashboards, store your metrics, and also mock one or several services: you are at the right place!

With this kind of configuration you will be able to make shift-left performance testing as well!

docker-compose is a small library that allows you to run docker-compose This is useful to bootstrap test environments. Docker Compose offers a multitude of benefits which I'll detail below:

  • Simplified configuration: Docker Compose lets you define and manage all the services of a multi-container application in a single YAML file. This makes it easy to configure, start and stop all the containers in an application.
  • Automated deployment: With a single configuration file, you can automate the deployment of all the services required for your application, reducing manual errors and improving consistency between development, test and production environments.
  • Managing dependencies : Compose makes it easy to manage dependencies between services. You can define the startup order of containers and the links between them, ensuring that all services start up in the right order and are properly connected.
  • Portability: Once you've defined your Compose file, you can easily share it and run it on different machines. This ensures that developers and operational teams work in identical environments, reducing compatibility problems.
  • Service isolation: Docker Compose creates isolated networks for containers, ensuring that each service operates in a partitioned environment. This improves security and enables services to be tested without mutual interference.
  • Scalability: Compose makes it easy to scale services. You can quickly adjust the number of containers for a particular service by simply modifying the configuration file and redeploying.
  • Local development and easy testing: Developers can use Docker Compose to create local development environments that faithfully reproduce production environments. This enables problems to be detected and resolved early in the development cycle.
  • CI/CD integration: Docker Compose integrates well with continuous integration and deployment (CI/CD) pipelines. You can use Compose files to orchestrate automatic tests and deployments in your CI/CD workflows.
  • Simplified maintenance: With Docker Compose, updating configurations and services becomes simpler. You can update container images or modify configurations by modifying the Compose file and redeploying services.

Build your own JMeter Docker Image and execute your Performance Test

If you'd like to run load tests in a simple way, and possibly share them, while benefiting from a simplified configuration, with a focus on writing your test plan, and its test typology, this article is for you!

Docker offers virtualization services that simplify the replication of working environments.

Furthermore, each virtualized service is isolated from unrelated services on other containers or the host machine, ensuring portability across host machines and the network.

Using JMeter within a Docker container offers several advantages :

Portability :

Docker enables the creation of lightweight and portable containers that can run on any Docker-compatible system, whether it's Linux, macOS, or Windows. This simplifies the deployment and management of JMeter, avoiding compatibility issues related to different system configurations.

Isolation :

Docker containers provide an isolated environment for running applications, meaning JMeter's dependencies and runtime environment are encapsulated within the container. This reduces potential conflicts with other applications or system components.

Ease of deployment :

With Docker, distributing and deploying JMeter across multiple machines or environments is straightforward.

You can create a Docker image containing JMeter and distribute it to your team or various test environments, streamlining the deployment process.

Version management :

By using Docker, you can version your Docker images containing JMeter, facilitating the management of different versions of JMeter used in your tests. You can also share these images via public or private Docker registries

JMeter JMesPath Extractor

Extracting values from server responses is a common operation in scripting scenarios for performance testing. In most cases it is a mandatory step in order to reproduce realistic traffic using dynamic values generated on server side like sessionIds or Tokens.

The most known way to extract values is using regular expression. While regular expressions are efficient for raw text-based responses, they are less efficient for structured responses like XML or JSON. JMeter provides specific extractors for those kind of responses. For JSON structures, JMeter implements 2 ways for handling them:

How to load test OpenID/OAUTH

Performance testing scripts need to go through authentication in order to access target services with the right authorization. They also need to validate that the authentication servers are able to handle the target load. OpenID Connect (OIDC) has become a popular authentication and authorization protocol for securing web applications. This article will present the OIDC protocol and how to implement a JMeter script to performance test it.

OIDC Protocol

The OIDC protocol allows the application to rely on an authentication server to identify users accessing it. Usually the authentication server is linked to the enterprise access directory. In other words this protocol is aimed at providing Single Sign-On (SSO) solution for applications. Some big internet actors even allow users to authenticate on third party services through OIDC (for example authenticating on Gitlab using a google account).

Use JMeter to create a website crawler

The idea behind this blog post originated when we updated our documentation after the release of our new UI. We had to identify all links used in the OctoPerf website and update them from https://doc.octoperf.com to https://api.octoperf.com/doc. With more than 250 blog posts at the time I'm writing this one, you can see how this could prove challenging. And of course the twist is that we also took this opportunity to reorganize the documentation so it's not as simple as a search and replace of the domain.

This got us thinking on ways to automate it, because a lot of third party links could also be broken and of course one of those ways is to use OctoPerf itself to execute JMeter tests that will report on all the broken links.