#!/bin/bash # Main script for running a benchmark. # Usage: # ./run_bench.sh 1 basic # ./run_bench.sh 1 syncbench # Specify the p4d instance (SDP installed port) and the name of the benchmark script: # basic/syncbench - corresponds to 2 files - locust_files/p4_basic.py or p4_syncbench.py and # their config_p4_basic.py etc. function bail () { echo -e "Error: ${1:-Unknown Error}\n"; exit ${2:-1}; } instance=${1:-Unset} [[ $instance == "Unset" ]] && bail "Specify instance as parameter" [[ ! -d /p4/$instance/logs ]] && bail "Instance $instance not found: /p4/$instance/logs" P4BENCH_SCRIPT=${2:-Unset} [[ $P4BENCH_SCRIPT == "Unset" ]] && bail "Specify P4BENCH_SCRIPT as second parameter" [[ ! -f locust_files/p4_$P4BENCH_SCRIPT.py ]] && bail "Benchmark script $P4BENCH_SCRIPT not found: locust_files/p4_$P4BENCH_SCRIPT.py" export P4BENCH_HOST=`hostname` export P4BENCH_SCRIPT # Calculate env vars to be picked up by run_master.sh export P4BENCH_NUM_SLAVES_PER_HOST=$(grep "num_slaves" hosts | awk '{print $2}') hosts=$(grep -A 99999 bench_clients: hosts | grep -E "^\s+\S+:$" | wc -l) export P4BENCH_NUM_HOSTS=$(($hosts - 2)) echo "Running p4_${P4BENCH_SCRIPT} on instance ${instance}" echo "Removing bruno clients" ./del_clients.sh $instance # Remove existing logs to make sure they don't clutter up the measurements [[ -f /p4/$instance/logs/log ]] && sudo rm /p4/$instance/logs/log # Remove shared logs on other (replica) servers if appropriate # E.g. via ssh or directly from shared storage #sudo rm /remote/p4/rep/h02_$instance/logs/log config_file="config_p4_${P4BENCH_SCRIPT}.yml" sed -e "s/:1666/:${instance}666/" < locust_files/$config_file > $config_file rm logs/*slave*.out echo "Removing remote logs..." ansible-playbook -i hosts ansible/rm_logs.yml > /dev/null ansible-playbook -i hosts ansible/post_bench.yml ansible-playbook -i hosts ansible/pre_bench.yml # Flush filesystem caches on server sudo sync sudo bash -c 'echo 3 > /proc/sys/vm/drop_caches' ./run_master.sh ansible-playbook -i hosts ansible/bench.yml echo "Running monitor jobs in background" nohup ./run_monitor.sh & echo ""
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#13 | 25529 | Robert Cowham |
Latest copy of files including docker compose setup. Merging //guest/robert_cowham/p4benchmark/pb/... to //guest/robert_cowham/p4benchmark/main/... |
||
#12 | 24851 | Robert Cowham |
Improve sql reporting. Log ps usage |
||
#11 | 24848 | Robert Cowham |
Drop caches per run. Increase num slaves to 70 |
||
#10 | 24758 | Robert Cowham | Tweak repeat count | ||
#9 | 24747 | Robert Cowham | Full parameterised - runs syncbench at least | ||
#8 | 24745 | Robert Cowham | Use global vars in hosts file | ||
#7 | 24735 | Robert Cowham | Fix running of sync | ||
#6 | 24711 | Robert Cowham | Restructure and tidy up | ||
#5 | 24687 | Robert Cowham | Got analysis working | ||
#4 | 22003 | Robert Cowham | Latest state - with p4python and no syncing | ||
#3 | 21902 | Robert Cowham | New run for mupltiple edges | ||
#2 | 21897 | Robert Cowham | Handle edge servers too | ||
#1 | 21767 | Robert Cowham | add latest stuff with analyse |