JMeter – CSV Data Set Config vs Redis Data Set Config – Throughput Comparison

In this post, I would like to show you how to use Redis Data Set Config in JMeter and how it affects the throughput of your test.

Redis:

Redis stands for REmote DIctionary Server. It is an open source in-memory data structure store database. It stores various data structures like String, Map, Lists, Sets etc as Key value pairs. As it is an in-memory database, It keeps all the data in the RAM (but it can also write the data in the disk periodically). So you get significant amount of performance boost while reading/writing the data.

Goal:

My goal here is to see how redis can be used with JMeter to keep my test data instead of a CSV file and to understand the kind of impact I will have in my test when I use Redis instead of CSV!

Why Redis:

Most of us would like to keep the test data for JMeter test in a CSV file. Even though CSV file is a very good choice – by keeping test data away from the test script, It becomes very difficult to manage when you use JMeter in distributed mode. As you probably know, JMeter simply executes the same jmx file in all the slaves. So, the CSV file, which is dependency for your JMeter test, should also be copied to all the slaves by you! Sometimes, the test data used by slave1 should not be used by slave2 [due to your application design]. In this case, you need to split the CSV file into multiple files for each slave and move them to slave machines to run the test successfully.

Redis will be a great choice here in JMeter distributed mode testing as it can serve the data for all the slaves.

CSV Data Set config:

  • First I create a very simple CSV file with 100,000 records.

csv-writer

  • I create a simple JMeter test to read the CSV file as shown in this picture.

csv-testplan-01

  • Now simply run this test in non-gui mode.

csv-run

  • OMG!! JMeter with CSV data set config can read 100K records in a second.

Redis Data Set config:

Now Lets do a similar test using Redis Data Set Config.

  • First ensure that you have ‘Redis Data Set Config’ plugin installed.
    • At this time of writing this post, JMeter Plugin Manager does not install Redis plugin correctly. The Redis jar is missing a property file. So It does not work.
    • Use this link to download the extra lib set. It has the working version of Redis Data Set Config.
  • Ensure that You have Redis is installed and are able to access it.  Check here for installation.
  • Lets create those 100,000 records in Redis as we did for CSV.

jedis-lpush

  • I create a very simple test to use Redis Data Set Config instead of CSV. Everything else remains unchanged.

redis-testplan

  • Run the test in non-gui mode.

redis-run

  • In my case, JMeter is able to read around 2300 records in a second which is OK.

Note:

  • I am sure that the reason behind the bad throughput of Redis is due to network latency as I run Redis server in a separate machine. JMeter connects to redis server for the data.
  • I have only one thread running in my JMeter test. So JMeter would have sent 100,000 requests to Redis to read the data sequentially.  
  • I can do a similar test by running the JMeter and Redis in a same machine where the performance would have been much much better. But my aim is here to see how Redis can be used for JMeter distributed testing. In this case, Redis has to run in a separate machine. That is why I test this way. Please correct me if you think otherwise!!
  • I would advise you to do similar test and compare the performance yourself. The result could be completely different for you and vary based on your machine configuration. 

Summary:

I expected this result because CSV file is going to be in your local and Redis DB is running somewhere else in my network. Network latency will play significant role in the Redis throughput. So CSV file read will perform better than Redis. However CSV read performs 40X better than Redis which is surprising. I am trying to share this information with you all so that you can be very careful when you create a JMeter test to test a very high throughput application. As I have been saying always we all need to be careful what kind of elements we add to the test.

You might be interested in reading few similar posts.

  1. Post Processors / Script Language – Comparison
  2. Response Data Extractors – Comparison

Happy Testing 🙂

 

Share This:

6 thoughts on “JMeter – CSV Data Set Config vs Redis Data Set Config – Throughput Comparison

  1. Quite interesting.
    I use Redis very often, And I never went in trouble with performances on DB side: the application limits come much earlier.
    Moreover, you can act on the server configuration (CPU+ RAM) to improve it.

    1. Issue could be network latency. Redis is great. But I have only one thread running in my JMeter test.So JMeter would have sent all the 100,000 requests to Redis to read the data sequentially.

  2. I don’t know the redis plugin for JMeter and am pretty new to both.
    Anyway, wouldn’t it be great to be able to define a “batch fetch” size for JMeter to fetch from redis?
    So for example get 1000 rows and start executing them. Once you start to run out of data, fetch the next batch.
    Thus one might be able to mitigate the additional network delay to some point and still keep the benefit of automatic and “even” distribution of the test data.

  3. I am new to redis and trying to add too 5000 user record into redis (to be used in Jmeter load test). can someone tell where to add and how we add the above redis code?
    I have installed redis and running fine in my windows

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.