diff --git a/runtime/Makefile b/runtime/Makefile index 765b1a6..2b85585 100644 --- a/runtime/Makefile +++ b/runtime/Makefile @@ -20,10 +20,10 @@ USE_MEM = USE_MEM_VM # Debugging Flags # Strips out calls to assert() -CFLAGS += -DNDEBUG +# CFLAGS += -DNDEBUG # Turns on debuglog and other assorted printfs in third party libs -# CFLAGS += -DDEBUG +CFLAGS += -DDEBUG # Redirects debuglogs to /runtime/bin/awesome.log #FIXME This log should be changed to sledge.log (and likely to a user defined path) diff --git a/runtime/experiments/applications/client1.sh b/runtime/experiments/applications/client1.sh deleted file mode 100755 index 1f840de..0000000 --- a/runtime/experiments/applications/client1.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -expected_result="This is q handw__tten -examp(e for _0CR, -Write as good as yo_ c4n." - -success_count=0 -total_count=1000 - -for ((i = 0; i < total_count; i++)); do - echo "$i" - result=$(curl -H 'Expect:' -H "Content-Type: text/plain" --data-binary "@handwrt1.pnm" localhost:10000 2>/dev/null) - # echo "$result" - if [[ "$result" == "$expected_result" ]]; then - success_count=$((success_count + 1)) - else - echo "FAIL" - echo "Expected $expected_result" - echo "Was $result" - fi -done - -echo "$success_count / $total_count" diff --git a/runtime/experiments/applications/5x8.png b/runtime/experiments/applications/fivebyeight/5x8.png similarity index 100% rename from runtime/experiments/applications/5x8.png rename to runtime/experiments/applications/fivebyeight/5x8.png diff --git a/runtime/experiments/applications/5x8.pnm b/runtime/experiments/applications/fivebyeight/5x8.pnm similarity index 100% rename from runtime/experiments/applications/5x8.pnm rename to runtime/experiments/applications/fivebyeight/5x8.pnm diff --git a/runtime/experiments/applications/fivebyeight/README.md b/runtime/experiments/applications/fivebyeight/README.md new file mode 100644 index 0000000..f793962 --- /dev/null +++ b/runtime/experiments/applications/fivebyeight/README.md @@ -0,0 +1,2 @@ +pnm file was generated as follows +`pngtopnm 5x8.png >5x8.pnm` diff --git a/runtime/experiments/applications/fivebyeight/debug.sh b/runtime/experiments/applications/fivebyeight/debug.sh new file mode 100755 index 0000000..a561392 --- /dev/null +++ b/runtime/experiments/applications/fivebyeight/debug.sh @@ -0,0 +1,19 @@ +#!/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 + +experiment_directory=$(pwd) +project_directory=$(cd ../../.. && pwd) +binary_directory=$(cd "$project_directory"/bin && pwd) + +export LD_LIBRARY_PATH="$binary_directory:$LD_LIBRARY_PATH" +export PATH="$binary_directory:$PATH" + +gdb --eval-command="handle SIGUSR1 nostop" \ + --eval-command="handle SIGPIPE nostop" \ + --eval-command="set pagination off" \ + --eval-command="set substitute-path /sledge/runtime $project_directory" \ + --eval-command="run $experiment_directory/spec.json" \ + sledgert diff --git a/runtime/experiments/applications/fivebyeight/expected_result.txt b/runtime/experiments/applications/fivebyeight/expected_result.txt new file mode 100644 index 0000000..bc3cf64 --- /dev/null +++ b/runtime/experiments/applications/fivebyeight/expected_result.txt @@ -0,0 +1,2 @@ +ABCD abcd EFGHI efghi JKLMN jklmn OPQR opqr +STUVW stuvw XYZ xyz 12345 67890 !?'&/\=+-*#(){}[]<> diff --git a/runtime/experiments/applications/fivebyeight/run.sh b/runtime/experiments/applications/fivebyeight/run.sh new file mode 100755 index 0000000..b702c23 --- /dev/null +++ b/runtime/experiments/applications/fivebyeight/run.sh @@ -0,0 +1,47 @@ +#!/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 + +experiment_directory=$(pwd) +project_directory=$(cd ../../.. && pwd) +binary_directory=$(cd "$project_directory"/bin && pwd) + +if [ "$1" != "-d" ]; then + PATH="$binary_directory:$PATH" LD_LIBRARY_PATH="$binary_directory:$LD_LIBRARY_PATH" sledgert "$experiment_directory/spec.json" & + sleep 1 +else + echo "Running under gdb" +fi + +expected_result="$(cat ./expected_result.txt)" + +success_count=0 +total_count=50 + +for ((i = 0; i < total_count; i++)); do + echo "$i" + result=$(curl -H 'Expect:' -H "Content-Type: text/plain" --data-binary "@5x8.pnm" localhost:10000 2>/dev/null) + # echo "$result" + if [[ "$result" == "$expected_result" ]]; then + success_count=$((success_count + 1)) + else + echo "FAIL" + echo "Expected:" + echo "$expected_result" + echo "===============================================" + echo "Was:" + echo "$result" + fi +done + +echo "$success_count / $total_count" + +if [ "$1" != "-d" ]; then + sleep 5 + echo -n "Running Cleanup: " + pkill sledgert >/dev/null 2>/dev/null + pkill wrk >/dev/null 2>/dev/null + echo "[DONE]" +fi diff --git a/runtime/experiments/applications/fivebyeight/spec.json b/runtime/experiments/applications/fivebyeight/spec.json new file mode 100644 index 0000000..e1357f3 --- /dev/null +++ b/runtime/experiments/applications/fivebyeight/spec.json @@ -0,0 +1,14 @@ +{ + "active": "yes", + "name": "gocr", + "path": "gocr.aso", + "port": 10000, + "relative-deadline-us": 50000000000, + "argsize": 1, + "http-req-headers": [], + "http-req-content-type": "text/plain", + "http-req-size": 1024000, + "http-resp-headers": [], + "http-resp-size": 1024000, + "http-resp-content-type": "text/plain" +} diff --git a/runtime/experiments/applications/handwriting/debug.sh b/runtime/experiments/applications/handwriting/debug.sh new file mode 100755 index 0000000..a561392 --- /dev/null +++ b/runtime/experiments/applications/handwriting/debug.sh @@ -0,0 +1,19 @@ +#!/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 + +experiment_directory=$(pwd) +project_directory=$(cd ../../.. && pwd) +binary_directory=$(cd "$project_directory"/bin && pwd) + +export LD_LIBRARY_PATH="$binary_directory:$LD_LIBRARY_PATH" +export PATH="$binary_directory:$PATH" + +gdb --eval-command="handle SIGUSR1 nostop" \ + --eval-command="handle SIGPIPE nostop" \ + --eval-command="set pagination off" \ + --eval-command="set substitute-path /sledge/runtime $project_directory" \ + --eval-command="run $experiment_directory/spec.json" \ + sledgert diff --git a/runtime/experiments/applications/handwriting/expected_result.txt b/runtime/experiments/applications/handwriting/expected_result.txt new file mode 100644 index 0000000..eee973d --- /dev/null +++ b/runtime/experiments/applications/handwriting/expected_result.txt @@ -0,0 +1,3 @@ +This is q handw__tten +examp(e for _0CR, +Write as good as yo_ c4n. diff --git a/runtime/experiments/applications/handwrt1.jpg b/runtime/experiments/applications/handwriting/handwrt1.jpg similarity index 100% rename from runtime/experiments/applications/handwrt1.jpg rename to runtime/experiments/applications/handwriting/handwrt1.jpg diff --git a/runtime/experiments/applications/handwrt1.pnm b/runtime/experiments/applications/handwriting/handwrt1.pnm similarity index 100% rename from runtime/experiments/applications/handwrt1.pnm rename to runtime/experiments/applications/handwriting/handwrt1.pnm diff --git a/runtime/experiments/applications/handwriting/run.sh b/runtime/experiments/applications/handwriting/run.sh new file mode 100755 index 0000000..82fedd8 --- /dev/null +++ b/runtime/experiments/applications/handwriting/run.sh @@ -0,0 +1,47 @@ +#!/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 + +experiment_directory=$(pwd) +project_directory=$(cd ../../.. && pwd) +binary_directory=$(cd "$project_directory"/bin && pwd) + +if [ "$1" != "-d" ]; then + PATH="$binary_directory:$PATH" LD_LIBRARY_PATH="$binary_directory:$LD_LIBRARY_PATH" sledgert "$experiment_directory/spec.json" & + sleep 1 +else + echo "Running under gdb" +fi + +expected_result="$(cat ./expected_result.txt)" + +success_count=0 +total_count=50 + +for ((i = 0; i < total_count; i++)); do + echo "$i" + result=$(curl -H 'Expect:' -H "Content-Type: text/plain" --data-binary "@handwrt1.pnm" localhost:10000 2>/dev/null) + # echo "$result" + if [[ "$result" == "$expected_result" ]]; then + success_count=$((success_count + 1)) + else + echo "FAIL" + echo "Expected:" + echo "$expected_result" + echo "===============================================" + echo "Was:" + echo "$result" + fi +done + +echo "$success_count / $total_count" + +if [ "$1" != "-d" ]; then + sleep 5 + echo -n "Running Cleanup: " + pkill sledgert >/dev/null 2>/dev/null + pkill wrk >/dev/null 2>/dev/null + echo "[DONE]" +fi diff --git a/runtime/experiments/applications/handwriting/spec.json b/runtime/experiments/applications/handwriting/spec.json new file mode 100644 index 0000000..e1357f3 --- /dev/null +++ b/runtime/experiments/applications/handwriting/spec.json @@ -0,0 +1,14 @@ +{ + "active": "yes", + "name": "gocr", + "path": "gocr.aso", + "port": 10000, + "relative-deadline-us": 50000000000, + "argsize": 1, + "http-req-headers": [], + "http-req-content-type": "text/plain", + "http-req-size": 1024000, + "http-resp-headers": [], + "http-resp-size": 1024000, + "http-resp-content-type": "text/plain" +} diff --git a/runtime/experiments/applications/hyde/README.md b/runtime/experiments/applications/hyde/README.md new file mode 100644 index 0000000..c2578d6 --- /dev/null +++ b/runtime/experiments/applications/hyde/README.md @@ -0,0 +1,5 @@ +# A Page from Dr. Jekyll and Mister Hyde + +This is a larger OCR example. The \*.pnm file is 5mb or so. + +In the future, this OCR example might be a good use case for a "step-wise" function, as the file is substantially smaller before conversion to the \*.pnm format. diff --git a/runtime/experiments/applications/hyde/debug.sh b/runtime/experiments/applications/hyde/debug.sh new file mode 100755 index 0000000..a561392 --- /dev/null +++ b/runtime/experiments/applications/hyde/debug.sh @@ -0,0 +1,19 @@ +#!/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 + +experiment_directory=$(pwd) +project_directory=$(cd ../../.. && pwd) +binary_directory=$(cd "$project_directory"/bin && pwd) + +export LD_LIBRARY_PATH="$binary_directory:$LD_LIBRARY_PATH" +export PATH="$binary_directory:$PATH" + +gdb --eval-command="handle SIGUSR1 nostop" \ + --eval-command="handle SIGPIPE nostop" \ + --eval-command="set pagination off" \ + --eval-command="set substitute-path /sledge/runtime $project_directory" \ + --eval-command="run $experiment_directory/spec.json" \ + sledgert diff --git a/runtime/experiments/applications/hyde/expected_result.txt b/runtime/experiments/applications/hyde/expected_result.txt new file mode 100644 index 0000000..5cdd7bf --- /dev/null +++ b/runtime/experiments/applications/hyde/expected_result.txt @@ -0,0 +1,33 @@ +at his to4ch of a certain icy pang along my blood. "Come, sir;' said I. +"Yo4 forget that I have not yet the pleas4re ofyo4r acq4aintance. Be +seated, if yo4 please: And I showed him an example, and sat down +myself in my c4stomary seat and with as fair an imitation of my or- +dinary manner to a patient, as the lateness of the ho4r, the nat4re of +my preocc4pations, and the horror I had of my visitor, wo4ld s4_er +me to m4ster. + "I beg yo4r pardon, Dr. Lanyon;' he replied civilly eno4gh. "What +yo4 say is very well fo4nded; and my impatience has shown its heels +to my politeness. I come here at the instance of yo4r colleag4e, Dr. +Henry _ekyll, on a piece of b4siness of some moment; and I 4nder- +stood.. ." He pa4sed and p4t his hand to his throat, and I co4ld see, +in spite of his collected manner, that he was wrestling against the +approaches of the hysteria-"I 4nderstood, a drawer.. ." + B4t here I took pity on my visito(0xed)s s4spense, and some perhaps +on my own growing c4riosity. + "mere it is, sir;' said I, pointing to the drawer, where it lay on the +noor behind a table and still covered with the sheet. + He sprang to it, and then pa4sed, and laid his hand 4pon his +heart; I co4ld hear his teeth grate with the conv4lsive action of his +jaws; and his face was so ghastly to see that I grew alarmed both for +his life and reason. + "Compose yo4rself_' said I. + He t4rned a dreadf4l smile to me, and as if with the decision of +despair, pl4cked away the sheet. At sight of the contents, he 4ttered +one lo4d sob of s4ch immense relief that I sat petri_ed. And the +next moment, in a voice that was already fairly well 4nder control, +"Have yo4 a grad4ated glass? " he asked. + I rose from my place with something of an e_ort and gave him +what he asked. + He thanked me with a smiling nod, meas4red o4t a few min- +ims of the red tinct4re and added one of the powders. me mix- +t4re, which was at _rst of a reddish h4e, began, in proportion as the diff --git a/runtime/experiments/applications/hyde.jpg b/runtime/experiments/applications/hyde/hyde.jpg similarity index 100% rename from runtime/experiments/applications/hyde.jpg rename to runtime/experiments/applications/hyde/hyde.jpg diff --git a/runtime/experiments/applications/hyde.pnm b/runtime/experiments/applications/hyde/hyde.pnm similarity index 100% rename from runtime/experiments/applications/hyde.pnm rename to runtime/experiments/applications/hyde/hyde.pnm diff --git a/runtime/experiments/applications/hyde/run.sh b/runtime/experiments/applications/hyde/run.sh new file mode 100755 index 0000000..e014e9c --- /dev/null +++ b/runtime/experiments/applications/hyde/run.sh @@ -0,0 +1,46 @@ +#!/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 + +experiment_directory=$(pwd) +project_directory=$(cd ../../.. && pwd) +binary_directory=$(cd "$project_directory"/bin && pwd) + +if [ "$1" != "-d" ]; then + PATH="$binary_directory:$PATH" LD_LIBRARY_PATH="$binary_directory:$LD_LIBRARY_PATH" sledgert "$experiment_directory/spec.json" & + sleep 1 +else + echo "Running under gdb" +fi + +expected_result="$(cat ./expected_result.txt)" +success_count=0 +total_count=50 + +for ((i = 0; i < total_count; i++)); do + echo "$i" + result=$(curl -H 'Expect:' -H "Content-Type: text/plain" --data-binary "@hyde.pnm" localhost:10000 2>/dev/null) + # echo "$result" + if [[ "$result" == "$expected_result" ]]; then + success_count=$((success_count + 1)) + else + echo "FAIL" + echo "Expected:" + echo "$expected_result" + echo "===============================================" + echo "Was:" + echo "$result" + fi +done + +echo "$success_count / $total_count" + +if [ "$1" != "-d" ]; then + sleep 5 + echo -n "Running Cleanup: " + pkill sledgert >/dev/null 2>/dev/null + pkill wrk >/dev/null 2>/dev/null + echo "[DONE]" +fi diff --git a/runtime/experiments/applications/hyde/spec.json b/runtime/experiments/applications/hyde/spec.json new file mode 100644 index 0000000..a175600 --- /dev/null +++ b/runtime/experiments/applications/hyde/spec.json @@ -0,0 +1,14 @@ +{ + "active": "yes", + "name": "gocr", + "path": "gocr.aso", + "port": 10000, + "relative-deadline-us": 50000000000, + "argsize": 1, + "http-req-headers": [], + "http-req-content-type": "text/plain", + "http-req-size": 5335057, + "http-resp-headers": [], + "http-resp-size": 5335057, + "http-resp-content-type": "text/plain" +} diff --git a/runtime/experiments/applications/latency.gnuplot b/runtime/experiments/applications/latency.gnuplot index 3955a77..095aa47 100644 --- a/runtime/experiments/applications/latency.gnuplot +++ b/runtime/experiments/applications/latency.gnuplot @@ -3,8 +3,8 @@ reset set term jpeg set output "latency.jpg" -set xlabel "Connections" -set xrange [-5:105] +set xlabel "Payload (bytes)" +set xrange [-5:1050000] set ylabel "Latency (ms)" set yrange [0:] diff --git a/runtime/experiments/applications/run.sh b/runtime/experiments/applications/run.sh index 01bab05..aca91b4 100755 --- a/runtime/experiments/applications/run.sh +++ b/runtime/experiments/applications/run.sh @@ -51,18 +51,24 @@ else echo "Running under gdb" >>"$results_directory/$log" fi +payloads=(fivebyeight/5x8 handwriting/handwrt1 hyde/hyde) +ports=(10000 10001 10002) +iterations=1000 + # Execute workloads long enough for runtime to learn excepted execution time -echo -n "Running Samples: " -hey -n 10000 -c 3 -q 200 -o csv -m GET http://localhost:10000 -sleep 5 -echo "[DONE]" +# echo -n "Running Samples: " +# for i in {0..2}; do +# hey -n 200 -c 3 -q 200 -o csv -m GET -D "$experiment_directory/${payloads[$i]}.pnm" "http://localhost:${ports[$i]}" +# done +# sleep 1 +# echo "[DONE]" # Execute the experiments -concurrency=(1 20 40 60 80 100) echo "Running Experiments" -for conn in ${concurrency[*]}; do - printf "\t%d Concurrency: " "$conn" - hey -n 10000 -c "$conn" -cpus 2 -o csv -m GET http://localhost:10000 >"$results_directory/con$conn.csv" +for i in {0..2}; do + printf "\t%s Payload: " "${payloads[$i]}" + file=$(echo "${payloads[$i]}" | awk -F/ '{print $2}').csv + hey -n "$iterations" -c 3 -cpus 2 -o csv -m GET -D "$experiment_directory/${payloads[$i]}.pnm" "http://localhost:${ports[$i]}" >"$results_directory/$file" echo "[DONE]" done @@ -83,24 +89,26 @@ printf "Concurrency,Success_Rate\n" >>"$results_directory/success.csv" printf "Concurrency,Throughput\n" >>"$results_directory/throughput.csv" printf "Con,p50,p90,p99,p100\n" >>"$results_directory/latency.csv" -for conn in ${concurrency[*]}; do +for payload in ${payloads[*]}; do # Calculate Success Rate for csv + file=$(echo "$payload" | awk -F/ '{print $2}') awk -F, ' $7 == 200 {ok++} - END{printf "'"$conn"',%3.5f\n", (ok / (NR - 1) * 100)} - ' <"$results_directory/con$conn.csv" >>"$results_directory/success.csv" + END{printf "'"$file"',%3.5f\n", (ok / '"$iterations"' * 100)} + ' <"$results_directory/$file.csv" >>"$results_directory/success.csv" # Filter on 200s, convery from s to ms, and sort - awk -F, '$7 == 200 {print ($1 * 1000)}' <"$results_directory/con$conn.csv" | - sort -g >"$results_directory/con$conn-response.csv" + awk -F, '$7 == 200 {print ($1 * 1000)}' <"$results_directory/$file.csv" | + sort -g >"$results_directory/$file-response.csv" # Get Number of 200s - oks=$(wc -l <"$results_directory/con$conn-response.csv") + oks=$(wc -l <"$results_directory/$file-response.csv") + ((oks == 0)) && continue # If all errors, skip line # Get Latest Timestamp - duration=$(tail -n1 "$results_directory/con$conn.csv" | cut -d, -f8) + duration=$(tail -n1 "$results_directory/$file.csv" | cut -d, -f8) throughput=$(echo "$oks/$duration" | bc) - printf "%d,%f\n" "$conn" "$throughput" >>"$results_directory/throughput.csv" + printf "%s,%f\n" "$file" "$throughput" >>"$results_directory/throughput.csv" # Generate Latency Data for csv awk ' @@ -110,16 +118,16 @@ for conn in ${concurrency[*]}; do p90 = int('"$oks"' * 0.9) p99 = int('"$oks"' * 0.99) p100 = '"$oks"' - printf "'"$conn"'," + printf "'"$file"'," } NR==p50 {printf "%1.4f,", $0} NR==p90 {printf "%1.4f,", $0} NR==p99 {printf "%1.4f,", $0} NR==p100 {printf "%1.4f\n", $0} - ' <"$results_directory/con$conn-response.csv" >>"$results_directory/latency.csv" + ' <"$results_directory/$file-response.csv" >>"$results_directory/latency.csv" # Delete scratch file used for sorting/counting - rm -rf "$results_directory/con$conn-response.csv" + rm -rf "$results_directory/$file-response.csv" done # Transform csvs to dat files for gnuplot diff --git a/runtime/experiments/applications/spec.json b/runtime/experiments/applications/spec.json index e1357f3..061491a 100644 --- a/runtime/experiments/applications/spec.json +++ b/runtime/experiments/applications/spec.json @@ -11,4 +11,33 @@ "http-resp-headers": [], "http-resp-size": 1024000, "http-resp-content-type": "text/plain" +}, +{ + "active": "yes", + "name": "gocr", + "path": "gocr.aso", + "port": 10001, + "relative-deadline-us": 50000000000, + "argsize": 1, + "http-req-headers": [], + "http-req-content-type": "text/plain", + "http-req-size": 1024000, + "http-resp-headers": [], + "http-resp-size": 1024000, + "http-resp-content-type": "text/plain" +}, +{ + "active": "yes", + "name": "gocr", + "path": "gocr.aso", + "port": 10002, + "relative-deadline-us": 50000000000, + "argsize": 1, + "http-req-headers": [], + "http-req-content-type": "text/plain", + "http-req-size": 5335057, + "http-resp-headers": [], + "http-resp-size": 5335057, + "http-resp-content-type": "text/plain" } + diff --git a/runtime/experiments/applications/tests.sh b/runtime/experiments/applications/tests.sh new file mode 100755 index 0000000..b7ce938 --- /dev/null +++ b/runtime/experiments/applications/tests.sh @@ -0,0 +1,10 @@ +#!/bin/bash +cd handwriting || exit +./run.sh +cd .. || exit +cd hyde || exit +./run.sh +cd .. || exit +cd fivebyeight || exit +./run.sh +cd .. diff --git a/runtime/experiments/concurrency/run.sh b/runtime/experiments/concurrency/run.sh index 01bab05..2a2542a 100755 --- a/runtime/experiments/concurrency/run.sh +++ b/runtime/experiments/concurrency/run.sh @@ -51,9 +51,11 @@ else echo "Running under gdb" >>"$results_directory/$log" fi +iterations=10000 + # Execute workloads long enough for runtime to learn excepted execution time echo -n "Running Samples: " -hey -n 10000 -c 3 -q 200 -o csv -m GET http://localhost:10000 +hey -n "$iterations" -c 3 -q 200 -o csv -m GET http://localhost:10000 sleep 5 echo "[DONE]" @@ -62,7 +64,7 @@ concurrency=(1 20 40 60 80 100) echo "Running Experiments" for conn in ${concurrency[*]}; do printf "\t%d Concurrency: " "$conn" - hey -n 10000 -c "$conn" -cpus 2 -o csv -m GET http://localhost:10000 >"$results_directory/con$conn.csv" + hey -n "$iterations" -c "$conn" -cpus 2 -o csv -m GET http://localhost:10000 >"$results_directory/con$conn.csv" echo "[DONE]" done @@ -87,7 +89,7 @@ for conn in ${concurrency[*]}; do # Calculate Success Rate for csv awk -F, ' $7 == 200 {ok++} - END{printf "'"$conn"',%3.5f\n", (ok / (NR - 1) * 100)} + END{printf "'"$conn"',%3.5f\n", (ok / '"$iterations"' * 100)} ' <"$results_directory/con$conn.csv" >>"$results_directory/success.csv" # Filter on 200s, convery from s to ms, and sort @@ -96,6 +98,7 @@ for conn in ${concurrency[*]}; do # Get Number of 200s oks=$(wc -l <"$results_directory/con$conn-response.csv") + ((oks == 0)) && continue # If all errors, skip line # Get Latest Timestamp duration=$(tail -n1 "$results_directory/con$conn.csv" | cut -d, -f8) diff --git a/runtime/experiments/payload/run.sh b/runtime/experiments/payload/run.sh index 2e5158f..8b0fe2a 100755 --- a/runtime/experiments/payload/run.sh +++ b/runtime/experiments/payload/run.sh @@ -53,6 +53,8 @@ fi payloads=(1024 10240 102400 1048576) ports=(10000 10001 10002 10003) +iterations=10000 + # If the one of the expected body files doesn't exist, trigger the generation script. for payload in ${payloads[*]}; do if test -f "$experiment_directory/body/$payload.txt"; then @@ -68,10 +70,10 @@ done # Execute workloads long enough for runtime to learn excepted execution time echo -n "Running Samples: " -hey -n 10000 -c 3 -q 200 -o csv -m GET -D "$experiment_directory/body/1024.txt" http://localhost:10000 -hey -n 10000 -c 3 -q 200 -o csv -m GET -D "$experiment_directory/body/10240.txt" http://localhost:10001 -hey -n 10000 -c 3 -q 200 -o csv -m GET -D "$experiment_directory/body/102400.txt" http://localhost:10002 -hey -n 10000 -c 3 -q 200 -o csv -m GET -D "$experiment_directory/body/1048576.txt" http://localhost:10003 +hey -n "$iterations" -c 3 -q 200 -o csv -m GET -D "$experiment_directory/body/1024.txt" http://localhost:10000 +hey -n "$iterations" -c 3 -q 200 -o csv -m GET -D "$experiment_directory/body/10240.txt" http://localhost:10001 +hey -n "$iterations" -c 3 -q 200 -o csv -m GET -D "$experiment_directory/body/102400.txt" http://localhost:10002 +hey -n "$iterations" -c 3 -q 200 -o csv -m GET -D "$experiment_directory/body/1048576.txt" http://localhost:10003 sleep 5 echo "[DONE]" @@ -79,11 +81,11 @@ echo "[DONE]" echo "Running Experiments" for i in {0..3}; do printf "\t%d Payload: " "${payloads[$i]}" - hey -n 10000 -c 1 -cpus 2 -o csv -m GET -D "$experiment_directory/body/${payloads[$i]}.txt" http://localhost:"${ports[$i]}" >"$results_directory/${payloads[$i]}.csv" + hey -n "$iterations" -c 1 -cpus 2 -o csv -m GET -D "$experiment_directory/body/${payloads[$i]}.txt" http://localhost:"${ports[$i]}" >"$results_directory/${payloads[$i]}.csv" echo "[DONE]" done -# Stop the runtime +# Stop the runtime if [ "$1" != "-d" ]; then sleep 5 echo -n "Running Cleanup: " @@ -103,7 +105,7 @@ for payload in ${payloads[*]}; do # Calculate Success Rate for csv awk -F, ' $7 == 200 {ok++} - END{printf "'"$payload"',%3.5f\n", (ok / (NR - 1) * 100)} + END{printf "'"$payload"',%3.5f\n", (ok / '"$iterations"' * 100)} ' <"$results_directory/$payload.csv" >>"$results_directory/success.csv" # Filter on 200s, convery from s to ms, and sort @@ -112,6 +114,7 @@ for payload in ${payloads[*]}; do # Get Number of 200s oks=$(wc -l <"$results_directory/$payload-response.csv") + ((oks == 0)) && continue # If all errors, skip line # Get Latest Timestamp duration=$(tail -n1 "$results_directory/$payload.csv" | cut -d, -f8)