There are two popular redis client for Node: node_redis and ioredis.
This repo is a simple benchmark for them. Welcome PR to makes this not tooooo simple >.<
First of all i must say ioredis is a real full-featured redis client right now. This is a really big PRO.
I have no malice for both libraries. Just wanna do a performance benchmark.
- Use
git clone [email protected]:poppinlp/node_redis-vs-ioredis.git
to clone this repo to local. - Use
yarn
ornpm i
to install dependencies. - Use
redis-server
to start redis server local with no password. - Use
npm test
to start benchmark.
I do this benchmark test on my PC whose hardware are:
- OS: Ubuntu 17.04 64-bit
- Processor: Intel® Core™ i5-4590 CPU @ 3.30GHz × 4
- Memory: 8GiB
- Graphics: GeForce GTX 750 Ti/PCIe/SSE2
I got these output:
node_redis set: 551.966ms
ioredis set: 679.761ms
ioredis set with pipeline: 156.763ms
node_redis get: 537.623ms
ioredis get: 640.003ms
ioredis get with pipeline: 164.286ms
node_redis hmset: 571.139ms
ioredis hmset: 747.225ms
ioredis hmset with pipeline: 208.449ms
node_redis hgetall: 618.184ms
ioredis hgetall: 736.134ms
ioredis hgetall with pipeline: 243.452ms
node_redis incr: 575.395ms
ioredis incr: 667.477ms
ioredis incr with pipeline: 170.836ms
node_redis keys: 682.787ms
ioredis keys: 746.521ms
ioredis keys with pipeline: 243.462ms
Welcome PR to makes this not tooooo simple >.<