🚅
Valkeyのベンチマーク
サマリ
- Redis forkでRedis互換のNoSQL Data storeであるValkeyの性能を把握する
- Single Node、ローカルアクセスの場合には大きな性能差は無いが、throughput, latencyともに数%程度valkeyの方が高い性能を示している
- 記事にある2倍以上の性能を出すには色々と環境を整える必要はありそう
Operation | valkey-tp [req/s] | redis-tp [req/s] | valkey-tp/redis-tp | valkey-lat[ms] | redis-lat[ms] | valkey-lat/redis-lat |
---|---|---|---|---|---|---|
PING_INLINE | 109170.3 | 108459.87 | 1.01 | 0.231 | 0.231 | 1.00 |
PING_MBULK | 109051.26 | 108342.37 | 1.01 | 0.231 | 0.239 | 0.97 |
SET | 109769.48 | 107874.87 | 1.02 | 0.231 | 0.239 | 0.97 |
GET | 109769.48 | 107874.87 | 1.02 | 0.231 | 0.239 | 0.97 |
INCR | 109649.12 | 107642.62 | 1.02 | 0.231 | 0.239 | 0.97 |
LPUSH | 110375.27 | 106496.27 | 1.04 | 0.231 | 0.239 | 0.97 |
RPUSH | 110011 | 107642.62 | 1.02 | 0.231 | 0.239 | 0.97 |
LPOP | 111358.58 | 109051.26 | 1.02 | 0.231 | 0.231 | 1.00 |
RPOP | 111358.58 | 108342.37 | 1.03 | 0.231 | 0.239 | 0.97 |
SADD | 109529.02 | 108695.65 | 1.01 | 0.231 | 0.231 | 1.00 |
HSET | 109289.62 | 106951.88 | 1.02 | 0.231 | 0.239 | 0.97 |
SPOP | 110011 | 109170.3 | 1.01 | 0.231 | 0.231 | 1.00 |
ZADD | 110011 | 106269.93 | 1.04 | 0.231 | 0.239 | 0.97 |
ZPOPMIN | 110011 | 107642.62 | 1.02 | 0.231 | 0.239 | 0.97 |
LPUSH (needed to benchmark LRANGE) | 110497.24 | 106496.27 | 1.04 | 0.231 | 0.239 | 0.97 |
LRANGE_100 (first 100 elements) | 64350.06 | 63734.86 | 1.01 | 0.391 | 0.391 | 1.00 |
LRANGE_300 (first 300 elements) | 29824.04 | 28810.14 | 1.04 | 0.839 | 0.863 | 0.97 |
LRANGE_500 (first 500 elements) | 20321.07 | 20096.46 | 1.01 | 1.231 | 1.239 | 0.99 |
LRANGE_600 (first 600 elements) | 17652.25 | 17394.33 | 1.01 | 1.423 | 1.439 | 0.99 |
MSET (10 keys) | 111482.72 | 110619.47 | 1.01 | 0.231 | 0.231 | 1.00 |
XADD | 110864.74 | 111607.14 | 0.99 | 0.231 | 0.231 | 1.00 |
Valkeyとは?
Official Site: https://valkey.io/
github: https://github.com/valkey-io/valkey
RedisからForkされたインメモリデータベース。RedisのApache 2.0ライセンスからRSALv2 (Redis Source Available License)|SSPLv1 (Server Side Public License)のデュアルライセンスへの移行に伴い、Fork。
publickeyの記事によれば、Valkey/Redis 7.2と比較して2倍以上の性能向上を謳っており、そのUpdateの中身は、こことここに記載されている。
そこで、どの程度速いのかを手元で確認してみることにする。
Valkeyインストール
gitからCloneしてmakeするとsrc配下にbinaryが生成される
$ git clone https://github.com/valkey-io/valkey.git
$ cd valkey
$ git checkout 8.0.1
$ make BUILD_RDMA=module # 後で試したいので
$ ls ./src/
...
valkey-benchmark
...
valkey-cli
...
valkey-server
...
Valkeyベンチマーク (Single Node)
環境
$ uname -a
Linux host 6.8.0-47-generic #47~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Oct 2 16:16:55 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
$ free -m
total used free shared buff/cache available
Mem: 31906 1629 22707 15 7568 29776
Swap: 2047 0 2047
$ cat /proc/cpuinfo | grep -e "processor" -e "model name"
processor : 0
model name : Intel(R) Core(TM) i5-9500 CPU @ 3.00GHz
processor : 1
model name : Intel(R) Core(TM) i5-9500 CPU @ 3.00GHz
processor : 2
model name : Intel(R) Core(TM) i5-9500 CPU @ 3.00GHz
processor : 3
model name : Intel(R) Core(TM) i5-9500 CPU @ 3.00GHz
processor : 4
model name : Intel(R) Core(TM) i5-9500 CPU @ 3.00GHz
processor : 5
model name : Intel(R) Core(TM) i5-9500 CPU @ 3.00GHz
valkey-server起動
$ ./src/valkey-server
666152:C 01 Nov 2024 23:25:39.788 * oO0OoO0OoO0Oo Valkey is starting oO0OoO0OoO0Oo
666152:C 01 Nov 2024 23:25:39.788 * Valkey version=8.0.1, bits=64, commit=4fbab574, modified=0, pid=666152, just started666152:C 01
666152:M 01 Nov 2024 23:25:39.788 * Increased maximum number of open files to 10032 (it was originally set to 1024).
666152:M 01 Nov 2024 23:25:39.788 * monotonic clock: POSIX clock_gettime
.+^+.
.+#########+.
.+########+########+. Valkey 8.0.1 (4fbab574/0) 64 bit
.+########+' '+########+.
.########+' .+. '+########. Running in standalone mode
|####+' .+#######+. '+####| Port: 6379
|###| .+###############+. |###| PID: 666152
|###| |#####*'' ''*#####| |###|
|###| |####' .-. '####| |###|
|###| |###( (@@@) )###| |###| https://valkey.io
|###| |####. '-' .####| |###|
|###| |#####*. .*#####| |###|
|###| '+#####| |#####+' |###|
|####+. +##| |#+' .+####|
'#######+ |##| .+########'
'+###| |##| .+########+'
'| |####+########+'
+#########+'
'+v+'
666152:M 01 Nov 2024 23:25:39.789 * Server initialized
666152:M 01 Nov 2024 23:25:39.789 * Loading RDB produced by Valkey version 8.0.1
666152:M 01 Nov 2024 23:25:39.789 * RDB age 85074 seconds
666152:M 01 Nov 2024 23:25:39.789 * RDB memory usage when created 1.34 Mb
666152:M 01 Nov 2024 23:25:39.789 * Done loading RDB, keys loaded: 6, keys expired: 0.
666152:M 01 Nov 2024 23:25:39.789 * DB loaded from disk: 0.000 seconds
666152:M 01 Nov 2024 23:25:39.789 * Ready to accept connections tcp
valkey-benchmark on valkey-server
$ ./src/valkey-benchmark -q -n 100000
PING_INLINE: 109170.30 requests per second, p50=0.231 msec
PING_MBULK: 109051.26 requests per second, p50=0.231 msec
SET: 109769.48 requests per second, p50=0.231 msec
GET: 109769.48 requests per second, p50=0.231 msec
INCR: 109649.12 requests per second, p50=0.231 msec
LPUSH: 110375.27 requests per second, p50=0.231 msec
RPUSH: 110011.00 requests per second, p50=0.231 msec
LPOP: 111358.58 requests per second, p50=0.231 msec
RPOP: 111358.58 requests per second, p50=0.231 msec
SADD: 109529.02 requests per second, p50=0.231 msec
HSET: 109289.62 requests per second, p50=0.231 msec
SPOP: 110011.00 requests per second, p50=0.231 msec
ZADD: 110011.00 requests per second, p50=0.231 msec
ZPOPMIN: 110011.00 requests per second, p50=0.231 msec
LPUSH (needed to benchmark LRANGE): 110497.24 requests per second, p50=0.231 msec
LRANGE_100 (first 100 elements): 64350.06 requests per second, p50=0.391 msec
LRANGE_300 (first 300 elements): 29824.04 requests per second, p50=0.839 msec
LRANGE_500 (first 500 elements): 20321.07 requests per second, p50=1.231 msec
LRANGE_600 (first 600 elements): 17652.25 requests per second, p50=1.423 msec
MSET (10 keys): 111482.72 requests per second, p50=0.231 msec
XADD: 110864.74 requests per second, p50=0.231 msec
valkey-benchmark on redis-server
redis-serverも起動し、同じvalkey-benchmarkをかけてみる
利用するRedis-serverはubuntu packageのものを利用
$ apt info redis-server
Package: redis-server
Version: 5:6.0.16-1ubuntu1
...
redis-serverに対してvalkey-benchmarkをかけた結果は以下。valkeyの場合
$ ./src/valkey-benchmark -q -n 100000
PING_INLINE: 108459.87 requests per second, p50=0.231 msec
PING_MBULK: 108342.37 requests per second, p50=0.239 msec
SET: 107874.87 requests per second, p50=0.239 msec
GET: 107874.87 requests per second, p50=0.239 msec
INCR: 107642.62 requests per second, p50=0.239 msec
LPUSH: 106496.27 requests per second, p50=0.239 msec
RPUSH: 107642.62 requests per second, p50=0.239 msec
LPOP: 109051.26 requests per second, p50=0.231 msec
RPOP: 108342.37 requests per second, p50=0.239 msec
SADD: 108695.65 requests per second, p50=0.231 msec
HSET: 106951.88 requests per second, p50=0.239 msec
SPOP: 109170.30 requests per second, p50=0.231 msec
ZADD: 106269.93 requests per second, p50=0.239 msec
ZPOPMIN: 107642.62 requests per second, p50=0.239 msec
LPUSH (needed to benchmark LRANGE): 106496.27 requests per second, p50=0.239 msec
LRANGE_100 (first 100 elements): 63734.86 requests per second, p50=0.391 msec
LRANGE_300 (first 300 elements): 28810.14 requests per second, p50=0.863 msec
LRANGE_500 (first 500 elements): 20096.46 requests per second, p50=1.239 msec
LRANGE_600 (first 600 elements): 17394.33 requests per second, p50=1.439 msec
MSET (10 keys): 110619.47 requests per second, p50=0.231 msec
XADD: 111607.14 requests per second, p50=0.231 msec
Discussion