diff --git a/runtime/tests/debug.sh b/runtime/tests/debug.sh new file mode 100755 index 00000000..aa128d58 --- /dev/null +++ b/runtime/tests/debug.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# Executes the runtime in GDB +# Substitutes the absolute path from the container with a path relatively derived from the location of this script +# This allows debugging outside of the Docker container +# Also disables pagination and stopping on SIGUSR1 + +declare project_path="$( + cd "$(dirname "$1")/../.." + pwd +)" +path=`pwd` +echo $project_path +cd $project_path/runtime/bin +#export SLEDGE_DISABLE_PREEMPTION=true +#export SLEDGE_SANDBOX_PERF_LOG=$path/srsf.log +export LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH" +gdb --eval-command="handle SIGUSR1 nostop" \ + --eval-command="set pagination off" \ + --eval-command="set substitute-path /sledge/runtime $project_path/runtime" \ + --eval-command="run ../tests/fib.json" \ + ./sledgert diff --git a/runtime/tests/empty.json b/runtime/tests/empty.json new file mode 100644 index 00000000..66e60d03 --- /dev/null +++ b/runtime/tests/empty.json @@ -0,0 +1,19 @@ +[ + { + "name": "gwu", + "port": 10030, + "replenishment-period-us": 0, + "max-budget-us": 0, + "routes": [ + { + "route": "/fib", + "path": "empty.wasm.so", + "admissions-percentile": 70, + "expected-execution-us": 4000, + "relative-deadline-us": 16000, + "http-resp-content-type": "text/plain" + } + ] + } +] + diff --git a/runtime/tests/fib.json b/runtime/tests/fib.json new file mode 100644 index 00000000..70741ff5 --- /dev/null +++ b/runtime/tests/fib.json @@ -0,0 +1,19 @@ +[ + { + "name": "gwu", + "port": 10030, + "replenishment-period-us": 0, + "max-budget-us": 0, + "routes": [ + { + "route": "/fib", + "path": "fibonacci.wasm.so", + "admissions-percentile": 70, + "expected-execution-us": 4000, + "relative-deadline-us": 16000, + "http-resp-content-type": "text/plain" + } + ] + } +] + diff --git a/runtime/tests/kill_sledge.sh b/runtime/tests/kill_sledge.sh new file mode 100755 index 00000000..7711de41 --- /dev/null +++ b/runtime/tests/kill_sledge.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +pid=`ps -ef|grep "sledgert"|grep -v grep |awk '{print $2}'` +echo $pid +sudo kill -2 $pid +sudo kill -9 $pid diff --git a/runtime/tests/parse.py b/runtime/tests/parse.py new file mode 100644 index 00000000..5baaeff3 --- /dev/null +++ b/runtime/tests/parse.py @@ -0,0 +1,46 @@ +import re +import os +import sys +from collections import defaultdict + +#get all file names which contain key_str +def file_name(file_dir, key_str): + throughput_table = defaultdict(list) + for root, dirs, files in os.walk(file_dir): + if root != os.getcwd(): + continue + for file_i in files: + if file_i.find(key_str) >= 0: + segs = file_i.split('-') + if len(segs) < 3: + continue + #print(file_i) + cores_num = segs[0] + concurrency = segs[2].split(".")[0] + #print("core:", cores_num, " concurrency:", concurrency) + get_values(cores_num, concurrency, file_i, throughput_table) + #file_table[key].append(file_i) + s_result = sorted(throughput_table.items()) + for i in range(len(s_result)): + print(s_result[i]) + +def get_values(core, concurrency, file_name, throughput_table): + cmd='grep "Requests/sec:" %s | awk \'{print $2}\'' % file_name + #cmd='python3 ~/sledge-serverless-framework/runtime/tests/meet_deadline_percentage.py %s 50' % file_name + rt=os.popen(cmd).read().strip() + #print(file_name, rt) + throughput_table[int(core)].append(rt) + + +if __name__ == "__main__": + import json + argv = sys.argv[1:] + if len(argv) < 1: + print("usage ", sys.argv[0], " file containing key word") + sys.exit() + + file_name(os.getcwd(), argv[0]) + + #for key, value in files_tables.items(): + # get_values(key, value, miss_deadline_rate, total_latency, running_times, preemption_count, total_miss_deadline_rate) + diff --git a/runtime/tests/parse_server.py b/runtime/tests/parse_server.py new file mode 100644 index 00000000..b355c2b3 --- /dev/null +++ b/runtime/tests/parse_server.py @@ -0,0 +1,65 @@ +import re +import os +import sys +from collections import defaultdict + +#get all file names which contain key_str +def file_name(file_dir, key_str): + throughput_table = defaultdict(list) + errors_table = defaultdict(list) + for root, dirs, files in os.walk(file_dir): + if root != os.getcwd(): + continue + for file_i in files: + if file_i.find(key_str) >= 0: + segs = file_i.split('-') + if len(segs) < 3: + continue + #print(file_i) + cores_num = segs[1] + concurrency = segs[3].split(".")[0] + print("core:", cores_num, " concurrency:", concurrency) + get_values(cores_num, concurrency, file_i, throughput_table, errors_table) + #file_table[key].append(file_i) + s_result = sorted(throughput_table.items()) + #for i in range(len(s_result)): + # print(s_result[i], "errors request:", errors_table[s_result[i][0]]) + for i in range(len(s_result)): + print(int(float(((s_result[i][1][0])))),end=" ") + print(); + #sys.exit() + +def get_values(core, concurrency, file_name, throughput_table, errors_table): + print("parse file:", file_name) + fo = open(file_name, "r+") + total_throughput = 0 + + for line in fo: + line = line.strip() + if "throughput is" in line: + i_th = float(line.split(" ")[2]) + total_throughput += i_th + + throughput_table[int(core)].append(total_throughput) + #cmd2='grep "throughput is" %s | awk \'{print $7}\'' % file_name + #rt2=os.popen(cmd2).read().strip() + #if len(rt2) != 0: + # errors = rt2.splitlines()[0] + # errors_table[int(core)].append(int(errors)) + #else: + # errors_table[int(core)].append(0) + #print(file_name, rt2) + + +if __name__ == "__main__": + import json + argv = sys.argv[1:] + if len(argv) < 1: + print("usage ", sys.argv[0], " file containing key word") + sys.exit() + + file_name(os.getcwd(), argv[0]) + + #for key, value in files_tables.items(): + # get_values(key, value, miss_deadline_rate, total_latency, running_times, preemption_count, total_miss_deadline_rate) + diff --git a/runtime/tests/parse_server_comma.py b/runtime/tests/parse_server_comma.py new file mode 100644 index 00000000..02dd954a --- /dev/null +++ b/runtime/tests/parse_server_comma.py @@ -0,0 +1,66 @@ +import re +import os +import sys +from collections import defaultdict + +#get all file names which contain key_str +def file_name(file_dir, key_str): + throughput_table = defaultdict(list) + errors_table = defaultdict(list) + for root, dirs, files in os.walk(file_dir): + if root != os.getcwd(): + continue + for file_i in files: + if file_i.find(key_str) >= 0: + segs = file_i.split('-') + if len(segs) < 3: + continue + #print(file_i) + cores_num = segs[1] + concurrency = segs[3].split(".")[0] + print("core:", cores_num, " concurrency:", concurrency) + get_values(cores_num, concurrency, file_i, throughput_table, errors_table) + #file_table[key].append(file_i) + s_result = sorted(throughput_table.items()) + #for i in range(len(s_result)): + # print(s_result[i], "errors request:", errors_table[s_result[i][0]]) + for i in range(len(s_result)): + print(int(float(((s_result[i][1][0])))),end=" ") + print(); + #sys.exit() + +def get_values(core, concurrency, file_name, throughput_table, errors_table): + print("parse file:", file_name) + fo = open(file_name, "r+") + total_throughput = 0 + + for line in fo: + line = line.strip() + if "throughput is" in line: + i_th = float(line.split(" ")[2].split(",")[0]) + #total_throughput += i_th + throughput_table[int(core)].append(i_th) + break + + #cmd2='grep "throughput is" %s | awk \'{print $7}\'' % file_name + #rt2=os.popen(cmd2).read().strip() + #if len(rt2) != 0: + # errors = rt2.splitlines()[0] + # errors_table[int(core)].append(int(errors)) + #else: + # errors_table[int(core)].append(0) + #print(file_name, rt2) + + +if __name__ == "__main__": + import json + argv = sys.argv[1:] + if len(argv) < 1: + print("usage ", sys.argv[0], " file containing key word") + sys.exit() + + file_name(os.getcwd(), argv[0]) + + #for key, value in files_tables.items(): + # get_values(key, value, miss_deadline_rate, total_latency, running_times, preemption_count, total_miss_deadline_rate) + diff --git a/runtime/tests/start.sh b/runtime/tests/start.sh new file mode 100755 index 00000000..47d305f2 --- /dev/null +++ b/runtime/tests/start.sh @@ -0,0 +1,41 @@ + +#!/bin/bash + +function usage { + echo "$0 [cpu cores]" + exit 1 +} + +if [ $# != 1 ] ; then + usage + exit 1; +fi + +core_num=$1 + +declare project_path="$( + cd "$(dirname "$0")/../.." + pwd +)" +echo $project_path +path=`pwd` +#export SLEDGE_DISABLE_PREEMPTION=true +#export SLEDGE_SIGALRM_HANDLER=TRIAGED +export SLEDGE_NWORKERS=$core_num +#export SLEDGE_SCHEDULER=EDF +#export SLEDGE_SANDBOX_PERF_LOG=/home/lyuxiaosu/sledge-serverless-framework/runtime/tests/server.log +#echo $SLEDGE_SANDBOX_PERF_LOG +cd $project_path/runtime/bin +#LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH" ./sledgert ../tests/test_fibonacci.json +#LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH" ./sledgert ../tests/test_big_fibonacci.json +#LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH" ./sledgert ../tests/test_armcifar10.json +#LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH" ./sledgert ../tests/test_png2bmp.json +#LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH" ./sledgert ../tests/test_image_processing.json +#LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH" ./sledgert ../tests/mulitple_linear_chain.json +#LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH" ./sledgert ../tests/test_multiple_image_processing.json +#LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH" ./sledgert ../tests/test_multiple_image_processing3.json +LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH" ./sledgert ../tests/fib.json +#LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH" ./sledgert ../tests/empty.json +#LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH" ./sledgert ../tests/my_fibonacci.json +#LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH" ./sledgert ../tests/test_sodresize.json +#LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH" ./sledgert ../tests/my_sodresize.json diff --git a/runtime/tests/test.sh b/runtime/tests/test.sh new file mode 100755 index 00000000..932e9daf --- /dev/null +++ b/runtime/tests/test.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +function usage { + echo "$0 [concurrency] [fib number]" + exit 1 +} + +if [ $# != 2 ] ; then + usage + exit 1; +fi + +#cores_list=(1 2 4 10 20 40 50 60 77) +#cores_list=(50 60) +#cores_list=(1 2 4 6 8 10 20 30 40 50 60 70 77) +concurrency=$1 +fib_num=$2 + +echo "fib num is $fib_num" +cores_list=(1 2 4 6 8 10 12 14 16 18 20 24 28 32 36 40 44 48 52 56 60 64 68 72 77) +#cores_list=(1) +ulimit -n 655350 +./kill_sledge.sh +for(( i=0;i<${#cores_list[@]};i++ )) do + hey_log=${cores_list[i]}"-$fib_num-$concurrency.log" #8-38-100 + server_log="server-"${cores_list[i]}"-$fib_num-$concurrency.log" + #./start.sh ${cores_list[i]} >/dev/null 2>&1 & + ./start.sh ${cores_list[i]} > $server_log 2>&1 & + echo "sledge start with worker core ${cores_list[i]}" + taskset --cpu-list 80-159 hey -disable-compression -disable-keepalive -disable-redirects -z "60"s -c "$concurrency" -m POST -d "$fib_num" "http://127.0.0.1:10030/fib" > $hey_log + #taskset --cpu-list 80-159 hey -disable-compression -disable-keepalive -disable-redirects -z "60"s -c "$concurrency" "http://127.0.0.1:10030/fib" > $hey_log + ./kill_sledge.sh +done + +folder_name="$fib_num""_c$concurrency" +mkdir $folder_name +mv *.log $folder_name diff --git a/runtime/tests/wrapper.sh b/runtime/tests/wrapper.sh new file mode 100755 index 00000000..435d5ed9 --- /dev/null +++ b/runtime/tests/wrapper.sh @@ -0,0 +1,9 @@ +#!/bin/bash + + +#concurrency_list=(50 100 200 300 400 1000) +concurrency_list=(200 300 400 1000) +for(( i=0;i<${#concurrency_list[@]};i++ )) do + ./test.sh ${concurrency_list[i]} 15 +done +