基于Predixy和LB构建高可用Redis-cluster(4)可用性压力测试

/ Linux服务安装搭建 / 没有评论 / 160浏览

分享一个脚本

[root@ELK-proxy-0-253 ~]# cat benchmark.sh
#! /bin/bash
port=7617
ip=192.168.0.253
cli="/root/redis-5.0.5/src/redis-cli"
for ((i=0;i<100000;i++))
do
echo -en "helloworld" | ${cli} -h ${ip} -p ${port} -x set name${i} >> ./benchmark.log
done

跑脚本 && 检查数据

[root@ELK-proxy-0-253 ~]# bash benchmark.sh
[root@ELK-proxy-0-253 ~]# cd /data/redis/

============ bgsave 落盘 =================
[root@ELK-proxy-0-253 redis]# redis-cli -p 6379
127.0.0.1:6379> BGSAVE
Background saving started
127.0.0.1:6379>
[root@ELK-proxy-0-253 redis]# redis-cli -p 6380
127.0.0.1:6380> BGSAVE
Background saving started
127.0.0.1:6380>
[root@ELK-proxy-0-253 redis]# redis-cli -p 6381
127.0.0.1:6381> BGSAVE
Background saving started
127.0.0.1:6381>
[root@ELK-proxy-0-253 redis]# redis-cli -p 6382
127.0.0.1:6382> BGSAVE
Background saving started
127.0.0.1:6382>
[root@ELK-proxy-0-253 redis]# redis-cli -p 6383
127.0.0.1:6383> BGSAVE
Background saving started
127.0.0.1:6383>
================ 所有实例数据量大小一致=================
[root@ELK-proxy-0-253 redis]# du -s ./*
17736	./6379
17736	./6380
17736	./6381
17736	./6382
17736	./6383

证明通过predixy代理之后,redis cluster在压力测试后,数据写入正常

性能分析

大部分set操作耗时在200毫秒左右

第1列代表小于等于第二列的耗时,第3列表示耗时总和,第四列表示总操作次数

T开头那一行,第二列表示平均耗时,第三列表示总耗时,第四列表示总操作次数

重启之后,统计数据全部归零。

# LatencyMonitor
LatencyMonitorName:all
<=          100                 5837               72 0.07%
<=          200             12096998            93673 91.50%
<=          300              1829037             7969 99.28%
<=          400               189120              569 99.84%
<=          500                39051               89 99.92%
<=          600                15878               29 99.95%
<=          700                 7617               12 99.96%
<=          800                 5192                7 99.97%
<=          900                10312               12 99.98%
<=         1000                 7758                8 99.99%
<=         1200                 5418                5 99.99%
<=         1400                 1273                1 100.00%
<=         2000                 3883                2 100.00%
<=         2500                 2376                1 100.00%
<=         3000                 2950                1 100.00%
<=         3500                 3372                1 100.00%
T           138             14226072           102451

LatencyMonitorName:get

LatencyMonitorName:set
<=          100                 3532               36 0.04%
<=          200             12096896            93672 91.50%
<=          300              1829037             7969 99.28%
<=          400               189120              569 99.84%
<=          500                39051               89 99.92%
<=          600                15878               29 99.95%
<=          700                 7617               12 99.96%
<=          800                 5192                7 99.97%
<=          900                10312               12 99.98%
<=         1000                 7758                8 99.99%
>          1000                19272               11 100.00%
T           138             14223665           102414

主机性能曲线图

下一篇 redis 集群性能提升篇