TDengine/tests/perftest-scripts/cassandraTestWriteLoop.sh

102 lines
2.3 KiB
Bash
Raw Normal View History

2020-07-23 07:24:28 +00:00
#!/bin/bash
DATA_DIR=/mnt/root/testdata
NUM_LOOP=1
NUM_OF_FILES=100
rowsPerRequest=(1 10 50 100 500 1000 2000)
function printTo {
if $verbose ; then
echo $1
fi
}
function runTest {
2020-07-27 04:12:10 +00:00
declare -A avgRPR
2020-07-23 07:24:28 +00:00
2020-07-27 04:12:10 +00:00
for r in ${!rowsPerRequest[@]}; do
for c in `seq 1 $clients`; do
2020-08-02 04:00:11 +00:00
avgRPR[$r,$c]=0
2020-07-27 04:12:10 +00:00
done
2020-07-23 07:24:28 +00:00
done
2020-07-27 04:12:10 +00:00
for r in ${!rowsPerRequest[@]}; do
2020-07-23 07:24:28 +00:00
for c in `seq 1 $clients`; do
totalRPR=0
2020-07-27 04:12:10 +00:00
OUT_FILE=cassandraWrite-rows${rowsPerRequest[$r]}-clients$c.out
2020-07-23 07:24:28 +00:00
for i in `seq 1 $NUM_LOOP`; do
printTo "loop i:$i, java -jar $CAS_TEST_DIR/cassandratest/target/cassandratest-1.0-SNAPSHOT-jar-with-dependencies.jar \
-datadir $DATA_DIR \
-numofFiles $NUM_OF_FILES \
2020-07-27 04:12:10 +00:00
-rowsperrequest ${rowsPerRequest[$r]} \
2020-07-23 07:24:28 +00:00
-writeclients $c \
-conf $CAS_TEST_DIR/application.conf"
java -jar $CAS_TEST_DIR/cassandratest/target/cassandratest-1.0-SNAPSHOT-jar-with-dependencies.jar \
-datadir $DATA_DIR \
-numofFiles $NUM_OF_FILES \
2020-07-27 04:12:10 +00:00
-rowsperrequest ${rowsPerRequest[$r]} \
2020-07-23 07:24:28 +00:00
-writeclients $c \
-conf $CAS_TEST_DIR/application.conf \
2020-07-27 04:12:10 +00:00
2>&1 | tee $OUT_FILE
2020-07-23 07:24:28 +00:00
RPR=`cat $OUT_FILE | grep "insertation speed:" | awk '{print $(NF-1)}'`
totalRPR=`echo "scale=4; $totalRPR + $RPR" | bc`
2020-07-27 04:12:10 +00:00
printTo "r:$r rows:${rowsPerRequest[$r]}, clients:$c, i:$i RPR:$RPR"
2020-07-23 07:24:28 +00:00
done
2020-07-27 04:12:10 +00:00
avgRPR[$r,$c]=`echo "scale=4; $totalRPR / $NUM_LOOP" | bc`
printTo "r:$r c:$c avgRPR:${avgRPR[$r,$c]}"
2020-07-23 07:24:28 +00:00
done
2020-07-27 04:12:10 +00:00
done
printf "R/R, "
for c in `seq 1 $clients`; do
if [ "$c" == "1" ]; then
printf "$c client, "
else
printf "$c clients, "
fi
done
printf "\n"
for r in ${!rowsPerRequest[@]}; do
printf "${rowsPerRequest[$r]}, "
2020-07-23 07:24:28 +00:00
for c in `seq 1 $clients`; do
2020-07-27 04:12:10 +00:00
printf "${avgRPR[$r,$c]}, "
2020-07-23 07:24:28 +00:00
done
printf "\n"
done
}
################ Main ################
verbose=false
clients=1
while : ; do
case $1 in
-v)
verbose=true
shift ;;
2020-08-02 04:00:11 +00:00
-n)
NUM_LOOP=$2
shift 2;;
2020-07-23 07:24:28 +00:00
-c)
clients=$2
shift 2;;
2020-08-02 04:00:11 +00:00
2020-07-23 07:24:28 +00:00
*)
break ;;
esac
done
printTo "Cassandra Test begin.."
WORK_DIR=/mnt/root/TDengine
CAS_TEST_DIR=$WORK_DIR/tests/comparisonTest/cassandra
runTest
printTo "Cassandra Test done!"