使用vire-benchmark压测Redis及其替代版

2023-11-23 15:47:14 浏览数 (1)

选择vire-benchmark而不是redis-benckmark,是因为vire-benchmark支持多并发压测。

vire-benchmark 是vire里面带的工具

源码仓库:https://github.com/vipshop/vire/tree/master

编译的方法参考git上就行,make后,会生成 vire 文件,此外在 tests目录下还有3个二进制文件( viretest、 vireabtest 、vire-benchmark)生成。

下面是我在本机二进制或者docker-compose方式启动的3个kv实例:

redis7 端口 6379 (本机二进制部署)

keydb6.3.0 端口 6389 (本机docker部署)

dragonfly latest 端口 6499 (本机docker部署)

下面只压测了最常见的几种操作指令

(因为压测工具和被压实例都部署在一台机器上,所以下面的指标仅供参考,正式压测请分开独立部署)

代码语言:javascript复制
压测redis7
$ ./vire-benchmark -h 192.168.31.181 -p 6379 -n 100000 -c 100 -T 16 -t set,get,hset,hget | egrep "====|requests"
        ====== SET ======
        100000 requests completed in 2.49 seconds
        40080.16 requests per second
        ====== GET ======
        100000 requests completed in 2.41 seconds
        41476.57 requests per second
        ====== HSET ======
        100000 requests completed in 2.62 seconds
        38109.75 requests per second
        ====== HGET ======
        100000 requests completed in 2.60 seconds
        38491.14 requests per second

压测keydb6.3
$ ./vire-benchmark -h 192.168.31.181 -p 6389 -n 100000 -c 100 -T 16 -t set,get,hset,hget | egrep "====|requests"
        ====== SET ======
        100000 requests completed in 1.67 seconds
        59952.04 requests per second
        ====== GET ======
        100000 requests completed in 1.62 seconds
        61538.46 requests per second
        ====== HSET ======
        100000 requests completed in 1.76 seconds
        56947.61 requests per second
        ====== HGET ======
        100000 requests completed in 1.68 seconds
        59488.40 requests per second

压测dragonfly
$ ./vire-benchmark -h 192.168.31.181 -p 6499 -n 100000 -c 100 -T 16 -t set,get,hset,hget | egrep "====|requests"
        ====== SET ======
        100000 requests completed in 0.93 seconds
        107296.14 requests per second
        ====== GET ======
        100000 requests completed in 0.86 seconds
        116279.07 requests per second
        ====== HSET ======
        100000 requests completed in 0.94 seconds
        106837.61 requests per second
        ====== HGET ======
        100000 requests completed in 0.87 seconds
        115606.94 requests per second

可以看到dragonfly的性能最强,主要是因为它原生的多线程, keydb也是多线程模式(keydb 6.3.0 在我压测过程中出现内存bug自动重启了)。而这里redis测出来最弱是因为单机的,对此redis官方也发过博客提到这个测试的不公平性。

0 人点赞