JMeter Test Data Control Using Redis

JMeter is most popular and open source tool for performance testing ,but there still some scenarios where we need to look for solution for the features which is not supported by JMeter, One of such scenario, imagine that you’ve got an application that you want to performance test, and that application requires test data to be consumed while testing,moreover you need to test that application with bulk users for which you have to also use multiple load generators machine.

For data parametrization you’ve used the CSV Data Set config. The CSV Data Set Config has some great features, letting you control most aspects of how data will be consumed for your test.One major shortcoming of the CSV Data Set Config, however, is that once the test has started, you need to have access to the file that JMeter is using if you want to update the data being used. Otherwise you’re locked in to the data that can be used for the test. For tests that you’re running on your local computer, this shouldn’t be an issue, you just save the CSV file with new data (or remove data you don’t want), and JMeter will reflect that change as long as it still has that file open.

So if you are doing performance testing in Distributed mode using different load generator machine or in Cloud (AWS,Google, Azure etc),Using a CSV file for data in this scenario will mean that each instance of your test running in the cloud will have it’s own copy of the data, making it problematic to make changes to the data. we need to have access to all those machine to update the test data consumed by JMeter, which time is consuming.

To address this issue/challenge how we can control test data on fly while using JMeter as performance testing tool , we need to use a Redis server running and  Redis Data Set plugin installed in JMeter .

In this post we will explain how to install the Redis Data Set JMeter plugin, how to install the Redis Database and populate it, and how to load test a website while taking values from the database.

Introduction to JMeter’s Redis Data Set

Redis (REmote DIctionary Server) is an open source, in-memory data structure store, used as a database, cache and message broker. As an in-memory database, it keeps all the data mostly in the RAM. Redis enables high performance when reading/writing data, and is also useful when you need to ensure unique data is used across all test servers.

Install the Redis Data Set JMeter Plugin

Install the Redis Data Set Plugins from the JMeter Plugins Manager:

  • Download the Plugins Manager JAR file
  • Copy the file to the lib/ext directory of your Jmeter
  • Restart JMeter
  • Click “Options” and then “Plugins Manager”
  • Click “Available Plugins”
  • Choose “Redis Data set” and then click “Apply Changes and Restart JMeter”

After restarting JMeter you should be able to see Redis Data Set config element in the menu.Right click on Test plan -> Add -> Config Element -> jp@gc – Redis Data Set.

Install and Start Redis

To install Redis on your Mac, type the following command in the terminal:

brew install redis

To learn how to install Redis for Linux, click here. For Windows, click here..After completing the installation, start it with the following command:


The Redis server should start in a few seconds. Test the Redis server in another terminal tab by executing the following command:

redis-cli ping

If the Redis server is set up correctly, you will see the response: “PONG”.

Inserting Data to Redis Database

The Redis server is up and running. Now it is time to populate it with some test data.Open the Redis command line interface by entering the following command in your terminal:


The Redis command line interface should open up.Add some data:

LPUSH qautomation Boston,Rome
LPUSH qautomation Portland,Berlin
LPUSH qautomation Paris,Cairo

Create JMeter Script With the Redis Data Set Config Element

Need to create a JMeter script to show how to use the Redis Data Set config element.

Creating a script for demo web site-

Consider the find flight scenario after login into website

Add a Thread Group to Test plan.Right click on Test plan -> Add -> Thread (Users) -> Thread Group

Add the Redis Data Set to the Thread Group.Thread Group -> Add -> Config element -> jp@gc – Redis Data Set

The ‘jp@gc – Redis Data Set’ has a number of parameters, let’s review some of them:

  • Name: This name will appear on the left panel. We can choose any name.
  • Redis key: This is a name for a list (ordered data) or a set (unordered data) in the Redis database. We chose ‘qautomatiob’ , when populating the database.
  • Variable Names: Those are names of variables exported by the Data Set to  he Test elements. In our case they are ‘from_port,to_port
  • Delimiter: This is the separator used within a row stored in the Redis list or set. We used a comma (‘,’), so let’s leave it as the default value.
  • Get Mode: There are two options:
    • RANDOM_REMOVE uses a Redis list. Once a value is retrieved it is removed from the List.
    • RANDOM_KEEP uses a Redis set. The retrieved value stays in the Set.

Important! We should leave the RANDOM_REMOVE option, since we created the Redis list in 6.

  • Redis server host: The IP or domain of your Redis server. We should type ‘localhost’, since we are running the Redis server locally.
  • Redis server port: Your Redis server port. Let’s leave it as the default value.
  • Password: The password if you a have password-protected Redis server. Let’s leave it as the default value.
  • Database: Database name. Let’s leave it as the default value.

Leave the other parameters with their default values.

 Now you can parametrized recorded Jmeter script by using jmeter variables ${from_port} and ${to_port}

.Run the script and check the results in the View Results Tree listener.


Categories: Jenkins, Out of Box

1 reply »

Leave a Reply

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

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

Google photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s