DEV Community

Kaustubh Rai
Kaustubh Rai

Posted on

Mass Insertion in Redis

We require a huge chunk of dummy data for Load Testing or Volume Testing and it's always a headache to create a dataset for testing. I am just going to show you an example to insert mass data in Redis.

In version 2.6 or later, redis-cli provides a new utility mode known as Pipe Mode. This pipe mode was designed to perform Mass Insertion. Redis provides functionality to insert huge chunks of data through the file.

Creating the txt File

We need to create a txt file that contains the complete chunk of data we need to insert in redis. As an example, I have written a Python Script to write all the data in a txt file that I need to insert in Redis.

The above script will produce a data.txt file that contains all the data we need to insert.

Redis Command

Go to the file location once the txt file is created and run the following command

If everything worked correctly you can see the file data in your Redis

Top comments (0)