redis cluster压测
#!/bin/bash
#LIENTS=50 #defaul clients
HOST='10.31.177.233'
PORT=7001
PWD='xxxxxxxxxxxxxx' # if have passwod
end_clients=2000
CMDS="set"
THREADS=4 #mutil threads
cmd_arry=(set get incr sadd mset mget hset) #ad hoc test redis command
KEYSPACE=100000
TOTAL_REQUESTS=500000 #default 100000
data_size=100 #Data size of SET/GET value in bytes (default 3)
CURRENT_DATE=`date +%Y%m%d`
bench_file='redis-benchmark'-${CURRENT_DATE}
benchmark='/usr/local/redis/bin/redis-benchmark'
echo "commond,clients,datasize,tps"
benchmark(){
cmd=$1
for clients in `seq 50 50 $end_clients`;do
if [ x"$pipeline" != "x" ];then
with_pipeline="-P $pipeline"
fi
benchmark_cmd="$benchmark -h $HOST -a $PWD -p $PORT --cluster --threads $THREADS -c $clients $with_pipeline -r $KEYSPACE -n $TOTAL_REQUESTS -t $cmd -d $data_size"
echo "[info] `date +"%Y-%m-%d %H:%M:%S"` : $benchmark_cmd ">>benchmark_cmd.log
tps=`$benchmark_cmd | grep "requests per second" | awk '{print $3}'`
echo "$cmd,$clients,$data_size,$tps" | tee -a ${bench_file}_${cmd}.txt
done
}
for cmdelement in ${cmd_arry[@]};do
echo $cmdelement
benchmark $cmdelement #don't use pipline
done
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
上次更新: 10/2/2024
- 02
- Flink 集群部署指南 原创09-20
- 03
- MongoDB 集群Config Server 复制集的工作原理09-14