#!/bin/bash function usage { echo "$0 [aad step] [first_rps] [max_rps]" exit 1 } if [ $# != 3 ] ; then usage exit 1; fi step=$1 current_rps=$2 max_rps=$3 chmod 400 ./id_rsa path="/home/weihao/sledge/sledge_tree/runtime/tests" last_actual_rps=0 first_run=true while [ $current_rps -le $max_rps ] do echo "Testing with RPS: $current_rps" server_log_file="test_max_rps.log" f1="105k_"$current_rps".txt" f2="305k_"$current_rps".txt" f3="5k_"$current_rps".txt" f4="40k_"$current_rps".txt" $path/start.sh $server_log_file >/dev/null 2>&1 & echo "sledge is running" ./test_rps.sh $f1 30 $current_rps 5k.jpg 10000 2>&1 & pid1=$! wait -f $pid1 # read hey ouput max rps actual_rps=$(grep "Requests/sec" "$f1" | awk '{print $2}') # read loadtest max rps # actual_rps=$(grep "Requests per second" "$f1" | awk '{print $4}') echo "Actual RPS achieved: $actual_rps" if [ "$first_run" = false ]; then if (( $(echo "$actual_rps <= $last_actual_rps" | bc -l) )); then echo "Actual RPS did not increase, stopping test." break fi fi last_actual_rps=$actual_rps # 标记第一次运行已完成 first_run=false current_rps=$((current_rps + step)) $path/kill_sledge.sh echo "sledge has been stopped" done echo "Max RPS testing completed."