Accelerating Redis Performance, One Benchmark at a Time!
RedisRacer is an ioredis vs node-redis performance benchmarking tool that makes use of the lightweight benchmarking library tinybench
and evaluates the speed and efficiency of Redis interactions between these two libraries through a range of benchmark operations such as GET, SET, HSET, HGETALL, and JSON operations. I built this tool in the hopes of understanding the performance differences between the two major NodeJS redis-libraries ioredis and node-redis. To my surprise, the findings I made differs slightly from other benchmarking tools I have found and tested previously.
The following tables summarize the performance benchmarks between Node-Redis
and IORedis
libraries based on operations per second (ops/sec), average time (in nanoseconds), and margin of error. This benchmark was made on my machine outside of docker.
Macbook Pro
Chip: Apple M2 Pro
Memory: 32GB
OS version: 14.2.1
Task Name | Ops/Sec | Average Time (ns) | Margin | Samples |
---|---|---|---|---|
GET | 32,064 | 31,187.59 | ±2.68% | 160321 |
SET | 32,915 | 30,381.13 | ±2.77% | 164576 |
HSET | 30,565 | 32,716.53 | ±2.22% | 152829 |
HGETALL | 31,717 | 31,528.65 | ±2.14% | 158586 |
JSON.GET | 29,387 | 34,027.76 | ±2.24% | 146939 |
JSON.SET | 30,007 | 33,325.25 | ±2.21% | 150037 |
MULTI-GET | 573 | 1,742,435.10 | ±2.96% | 2870 |
Task Name | Ops/Sec | Average Time (ns) | Margin | Samples |
---|---|---|---|---|
GET | 33,079 | 30,230.00 | ±2.66% | 165399 |
SET | 34,138 | 29,292.63 | ±2.54% | 170692 |
HSET | 32,608 | 30,666.58 | ±1.82% | 163045 |
HGETALL | 34,179 | 29,257.15 | ±2.14% | 170899 |
JSON.GET | 31,749 | 31,497.05 | ±2.10% | 158746 |
JSON.SET | 32,115 | 31,137.53 | ±2.76% | 161140 |
MULTI-GET | 525 | 1,903,613.81 | ±2.68% | 2627 |
Library | Average Ops/Sec |
---|---|
Node-Redis | 26,746.86 |
IORedis | 28,341.86 |
Based on my runs, the IORedis
library shows the highest performance with an average of 28,341.86
operations per second.
Please refer to the full benchmark tests for a comprehensive understanding of the performance and behavior under different conditions.
└── RedisRacer/
├── LICENSE
├── docker-compose.yml
├── nodemon.json
├── package-lock.json
├── package.json
├── src
│ ├── benchmarks
│ ├── connection
│ ├── constants
│ ├── helpers
│ ├── index.ts
│ └── types
└── tsconfig.json
- GET
- SET
- HGETALL
- HSET
- MULTI
- JSON
- GET
- SET
..more to come
- Clone the RedisRacer repository:
$ git clone https://github.com/rutbergphilip/RedisRacer
- Change to the project directory:
$ cd RedisRacer
- Install the dependencies:
$ npm install
- Start Redis server with the JSON module:
docker-compose up --build
- Start the application:
npm start
-
► Benchmark more operations
-
► Add unit tests
Contributions are more than welcome in order to help improve the accuracy of the tool! Here are several ways you can contribute:
- Report Issues: Submit bugs found or log feature requests for the
RedisRacer
project. - Submit Pull Requests: Review open PRs, and submit your own PRs.
Contributing Guidelines
- Fork the Repository: Start by forking the project repository to your github account.
- Clone Locally: Clone the forked repository to your local machine using a git client.
git clone https://github.com/rutbergphilip/RedisRacer
- Create a New Branch: Always work on a new branch, giving it a descriptive name.
git checkout -b new-benchmarks
- Make Your Changes: Develop and test your changes locally.
- Commit Your Changes: Commit with a clear message describing your updates.
git commit -m 'Implemented some more benchmarks'
- Push to github: Push the changes to your forked repository.
git push origin new-benchmarks
- Submit a Pull Request: Create a PR against the original project repository where you clearly describe the changes and their motivations.
- Review: Once your PR is reviewed and approved, it will be merged into the main branch. 😃
This project is inspired by the benchmarking application made by poppinlp