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..7d9772f6 --- /dev/null +++ b/runtime/tests/kill_sledge.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +pid=`ps -ef|grep "sledgert"|grep -v grep |awk '{print $2}'` +echo $pid +sudo kill -2 $pid diff --git a/runtime/tests/parse.py b/runtime/tests/parse.py new file mode 100644 index 00000000..dc262e7b --- /dev/null +++ b/runtime/tests/parse.py @@ -0,0 +1,49 @@ +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]) + for i in range(len(s_result)): + print(int(float(((s_result[i][1][0])))),end=" ") + print(); + +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/print_timecost.py b/runtime/tests/print_timecost.py new file mode 100644 index 00000000..4d4c47f7 --- /dev/null +++ b/runtime/tests/print_timecost.py @@ -0,0 +1,58 @@ +import json +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): + cost_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) < 2: + print("less than 2 segs", file_i) + continue + #print(file_i) + name = segs[0] + #print("core:", cores_num, " concurrency:", concurrency) + get_values(name, file_i, cost_table) + #file_table[key].append(file_i) + #s_result = sorted(throughput_table.items()) + #for i in range(len(s_result)): + # print(s_result[i]) + #for i in range(len(s_result)): + # print(int(float(((s_result[i][1][0])))),end=" ") + #print(); + for key, value in cost_table.items(): + print(key, len(value)) + js = json.dumps(cost_table) + f = open("cost.txt", 'w') + f.write(js) + f.close() + + +def get_values(name, file_name, cost_table): + fo = open(file_name, "r+") + for line in fo: + line = line.strip() + if line[0].isdigit(): + str_list = line.split(" ") + for i in range(len(str_list)): + cost_table[name].append(int(str_list[i])) + +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/set_cpu.sh b/runtime/tests/set_cpu.sh new file mode 100755 index 00000000..07a5188d --- /dev/null +++ b/runtime/tests/set_cpu.sh @@ -0,0 +1 @@ +sudo cpupower frequency-set -g performance diff --git a/runtime/tests/start.sh b/runtime/tests/start.sh new file mode 100755 index 00000000..2211438b --- /dev/null +++ b/runtime/tests/start.sh @@ -0,0 +1,42 @@ + +#!/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=$path/$output +#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..0c7c301d --- /dev/null +++ b/runtime/tests/test.sh @@ -0,0 +1,38 @@ +#!/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=(6 8 12 14 16 18 24 28 32 36 77) +#cores_list=(77) +ulimit -n 1000000 +./kill_sledge.sh +for(( i=0;i<${#cores_list[@]};i++ )) do + hey_log=${cores_list[i]}"-$fib_num-$concurrency.log" #8-38-100 + loadtest_log=${cores_list[i]}"-$fib_num-$concurrency.log" + server_log="server-"${cores_list[i]}"-$fib_num-$concurrency.log" + ./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 +