From ec40ad0c0cdc5b6112ddaee69bb728f19b7b3149 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Sat, 26 Sep 2020 18:15:15 -0400 Subject: [PATCH] chore: Various experiments --- runtime/tests/mixed_preemption/demo.sh | 57 +++++----- runtime/tests/mixed_preemption/post.lua | 35 ++++-- runtime/tests/mixed_preemption/res/fib10.txt | 107 ------------------ runtime/tests/raw_utilization/debug.sh | 19 ++++ runtime/tests/raw_utilization/demo.sh | 39 +++++++ runtime/tests/raw_utilization/post.lua | 58 ++++++++++ .../test_mixed_preemption.json | 70 ++++++++++++ 7 files changed, 240 insertions(+), 145 deletions(-) delete mode 100644 runtime/tests/mixed_preemption/res/fib10.txt create mode 100755 runtime/tests/raw_utilization/debug.sh create mode 100755 runtime/tests/raw_utilization/demo.sh create mode 100644 runtime/tests/raw_utilization/post.lua create mode 100644 runtime/tests/raw_utilization/test_mixed_preemption.json diff --git a/runtime/tests/mixed_preemption/demo.sh b/runtime/tests/mixed_preemption/demo.sh index 199cef7..3fdb1e9 100755 --- a/runtime/tests/mixed_preemption/demo.sh +++ b/runtime/tests/mixed_preemption/demo.sh @@ -1,33 +1,34 @@ #!/bin/bash -# cd ../../bin -# LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH" ./sledgert ../tests/mixed_preemption/test_mixed_preemption.json & -# cd ../tests/mixed_preemption/ +cd ../../bin +LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH" ./sledgert ../tests/mixed_preemption/test_mixed_preemption.json & +cd ../tests/mixed_preemption/ -# TODO: Run small samples on each port to let the runtime figure out the execution time -# ab -s 999999999 -v 4 -n 50 -c 1 -r -p ./req/fib10.txt localhost:10010/ -# ab -s 999999999 -v 4 -n 50 -c 1 -r -p ./req/fib20.txt localhost:10020/ -# ab -s 999999999 -v 4 -n 50 -c 1 -r -p ./req/fib25.txt localhost:10025/ -# ab -s 999999999 -v 4 -n 50 -c 1 -r -p ./req/fib30.txt localhost:10030/ -# ab -s 999999999 -v 4 -n 50 -c 1 -r -p ./req/fib35.txt localhost:10035/ -wrk -d 10s -t1 -s post.lua http://localhost:10010 -- 2 10\n >/dev/null -# wrk -d 10s -t1 -s post.lua http://localhost:10030 -- 2 30\n >/dev/null -# wrk -d 1m -t1 -s post.lua http://localhost:10020 -- 2 20\n +# Run small samples on each port to let the runtime figure out the execution time +sleep 10 +echo "Running Samples" +wrk -d 20s -t1 -s post.lua http://localhost:10010 -- --delay 500 10\n +wrk -d 20s -t1 -s post.lua http://localhost:10020 -- --delay 500 20\n +wrk -d 20s -t1 -s post.lua http://localhost:10030 -- --delay 500 25\n -# fib(10) -# sleep 2 -# wrk -d 1m -t1 -s post.lua http://localhost:10010 -- 20 10\n >./res/fib10.txt -# wrk -d 1m -t1 -s post.lua http://localhost:10020 -- 2 20\n >./res/fib20.txt & -# wrk -d 1m -t1 -s post.lua http://localhost:10025 -- 2 25\n >./res/fib25.txt & -# wrk -d 1m -t1 -s post.lua http://localhost:10030 -- 2 30\n >./res/fib30.txt -# wrk -d 1m -t1 -s post.lua http://localhost:10035 -- 2 35\n -# ab -n 10000 -c 1 -r -p ./req/fib10.txt localhost:10000/ >./res/fib10.txt & -# ab -n 10000 -c 1 -r -p ./req/fib20.txt localhost:10001/ >./res/fib20.txt & -# ab -n 10000 -c 1 -r -p ./req/fib25.txt localhost:10002/ >./res/fib25.txt & -# ab -n 10000 -c 1 -r -p ./req/fib30.txt localhost:10030/ >./res/fib30.txt & -# ab -n 10000 -c 1 -r -p ./req/fib35.txt localhost:10035/ >./res/fib35.txt +# Run in Parallel +sleep 10 +echo "Running Experiments" +wrk -d 1m -t1 -s post.lua http://localhost:10010 -- --delay 125 10\n >./res/fib10.txt & +wrk -d 2m -t1 -s post.lua http://localhost:10020 -- --delay 250 20\n >./res/fib20.txt & +wrk -d 3m -t1 -s post.lua http://localhost:10025 -- --delay 500 25\n >./res/fib25.txt # Kill the Background Sledge processes -# ps -e -o pid,cmd | grep sledgert | grep json | cut -d\ -f 1 | xargs kill -# pkill sledgert -# pkill ab -# pkill wrk +sleep 10 +echo "Running Cleanup" +pkill sledgert +pkill wrk + +# Extract the Latency CSV Data from the Log + +echo 'Fib10, Fib10' >./res/fib10.csv +grep -A200 -m1 -e 'Percentile, Latency' ./res/fib10.txt >>./res/fib10.csv +echo 'Fib20, Fib20' >./res/fib20.csv +grep -A200 -m1 -e 'Percentile, Latency' ./res/fib20.txt >>./res/fib20.csv +echo 'Fib25, Fib25' >./res/fib25.csv +grep -A200 -m1 -e 'Percentile, Latency' ./res/fib25.txt >>./res/fib25.csv +paste -d, ./res/fib10.csv ./res/fib20.csv ./res/fib25.csv >./res/merged.csv diff --git a/runtime/tests/mixed_preemption/post.lua b/runtime/tests/mixed_preemption/post.lua index ca74290..84d7779 100644 --- a/runtime/tests/mixed_preemption/post.lua +++ b/runtime/tests/mixed_preemption/post.lua @@ -5,14 +5,28 @@ wrk.headers["Content-Type"] = "text/plain" local delay_val = 1000 function init(args) - if #args >= 1 then - -- First argument is "requests per second" per thread - delay_val = (1000 / args[1]) - end - - if #args >= 2 then - -- Second argument is argument - wrk.body = args[2] + if #args == 0 then + io.write("[wrk stuff] -- --delay [delay in ms] [args ...]\n") + os.exit(); + end + + local current_arg = 1 + while current_arg <= #args do + if args[current_arg] == "--delay" then + delay_val = args[current_arg + 1] + current_arg = current_arg + 2; + io.write(string.format("Delay: %s\n", delay_val)) + else + -- Concatenate all remaining args + local buffer = "" + for i = current_arg, #args, 1 do + buffer = buffer .. args[i] + end + io.write(string.format("Buffer: %s\n", buffer)) + wrk.body = buffer + -- And exit loop + break; + end end end @@ -27,15 +41,16 @@ function delay() end function response(status, headers, body) - io.write(string.format("%s: %s\n", status, body)) + -- io.write(string.format("%s: %s\n", status, body)) end -- Done Phase -- Called when complete, presenting aggregate results function done(summary, latency, requests) + io.write("Percentile, Latency\n"); for i = 1, 99 do - io.write(string.format("%d %d\n", i, latency:percentile(i))) + io.write(string.format("%d, %d\n", i, latency:percentile(i))) end end diff --git a/runtime/tests/mixed_preemption/res/fib10.txt b/runtime/tests/mixed_preemption/res/fib10.txt deleted file mode 100644 index 97b9930..0000000 --- a/runtime/tests/mixed_preemption/res/fib10.txt +++ /dev/null @@ -1,107 +0,0 @@ -Running 1m test @ http://localhost:10010 - 1 threads and 10 connections - Thread Stats Avg Stdev Max +/- Stdev - Latency 0.00us 0.00us 0.00us -nan% - Req/Sec 0.00 0.00 0.00 -nan% - 0 requests in 1.00m, 0.00B read -Requests/sec: 0.00 -Transfer/sec: 0.00B -1 0 -2 0 -3 0 -4 0 -5 0 -6 0 -7 0 -8 0 -9 0 -10 0 -11 0 -12 0 -13 0 -14 0 -15 0 -16 0 -17 0 -18 0 -19 0 -20 0 -21 0 -22 0 -23 0 -24 0 -25 0 -26 0 -27 0 -28 0 -29 0 -30 0 -31 0 -32 0 -33 0 -34 0 -35 0 -36 0 -37 0 -38 0 -39 0 -40 0 -41 0 -42 0 -43 0 -44 0 -45 0 -46 0 -47 0 -48 0 -49 0 -50 0 -51 0 -52 0 -53 0 -54 0 -55 0 -56 0 -57 0 -58 0 -59 0 -60 0 -61 0 -62 0 -63 0 -64 0 -65 0 -66 0 -67 0 -68 0 -69 0 -70 0 -71 0 -72 0 -73 0 -74 0 -75 0 -76 0 -77 0 -78 0 -79 0 -80 0 -81 0 -82 0 -83 0 -84 0 -85 0 -86 0 -87 0 -88 0 -89 0 -90 0 -91 0 -92 0 -93 0 -94 0 -95 0 -96 0 -97 0 -98 0 -99 0 diff --git a/runtime/tests/raw_utilization/debug.sh b/runtime/tests/raw_utilization/debug.sh new file mode 100755 index 0000000..5541f0c --- /dev/null +++ b/runtime/tests/raw_utilization/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 + +declare project_path="$( + cd "$(dirname "$1")/../.." + pwd +)" +echo $project_path +cd ../../bin +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" \ + --eval-command="run ../tests/raw_utilization/test_mixed_preemption.json" \ + ./sledgert +cd ../../tests diff --git a/runtime/tests/raw_utilization/demo.sh b/runtime/tests/raw_utilization/demo.sh new file mode 100755 index 0000000..a1efbfc --- /dev/null +++ b/runtime/tests/raw_utilization/demo.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# cd ../../bin +# LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH" ./sledgert ../tests/mixed_preemption/test_mixed_preemption.json & +# cd ../tests/mixed_preemption/ + +# Run small samples on each port to let the runtime figure out the execution time +sleep 10 +echo "Running Samples" +wrk -d 1m -t 1 -s post.lua http://localhost:10025 -- --delay 0 25\n + +# Run in Serial, increasing number of open connections +sleep 10 +echo "Running Experiments" +wrk --duration 1m --threads 1 --connections 10 --timeout 10m --script post.lua http://localhost:10025 -- --delay 0 25\n >./res/con10.txt +wrk --duration 1m --threads 1 --connections 15 --timeout 10m --script post.lua http://localhost:10025 -- --delay 0 25\n >./res/con15.txt +wrk --duration 1m --threads 1 --connections 20 --timeout 10m --script post.lua http://localhost:10025 -- --delay 0 25\n >./res/con20.txt +wrk --duration 1m --threads 1 --connections 25 --timeout 10m --script post.lua http://localhost:10025 -- --delay 0 25\n >./res/con25.txt + +# Kill the Background Sledge processes +sleep 10 +echo "Running Cleanup" +pkill sledgert +pkill wrk + +# Extract the Latency CSV Data from the Log + +echo 'con10, con10' >./res/con10.csv +grep -A200 -m1 -e 'Percentile, Latency' ./res/con10.txt >>./res/con10.csv + +echo 'con15, con15' >./res/con15.csv +grep -A200 -m1 -e 'Percentile, Latency' ./res/con15.txt >>./res/con15.csv + +echo 'con20, con20' >./res/con20.csv +grep -A200 -m1 -e 'Percentile, Latency' ./res/con20.txt >>./res/con20.csv + +echo 'con25, con25' >./res/con25.csv +grep -A200 -m1 -e 'Percentile, Latency' ./res/con25.txt >>./res/con25.csv + +paste -d, ./res/con10.csv ./res/con15.csv ./res/con20.csv ./res/con25.csv >./res/merged.csv diff --git a/runtime/tests/raw_utilization/post.lua b/runtime/tests/raw_utilization/post.lua new file mode 100644 index 0000000..84d7779 --- /dev/null +++ b/runtime/tests/raw_utilization/post.lua @@ -0,0 +1,58 @@ +-- Default to 1 request / second +wrk.method = "POST" +wrk.body = "10\n" +wrk.headers["Content-Type"] = "text/plain" +local delay_val = 1000 + +function init(args) + if #args == 0 then + io.write("[wrk stuff] -- --delay [delay in ms] [args ...]\n") + os.exit(); + end + + local current_arg = 1 + while current_arg <= #args do + if args[current_arg] == "--delay" then + delay_val = args[current_arg + 1] + current_arg = current_arg + 2; + io.write(string.format("Delay: %s\n", delay_val)) + else + -- Concatenate all remaining args + local buffer = "" + for i = current_arg, #args, 1 do + buffer = buffer .. args[i] + end + io.write(string.format("Buffer: %s\n", buffer)) + wrk.body = buffer + -- And exit loop + break; + end + end +end + +-- Uncomment to dynamically generate a different request each time +-- function request() +-- return wrk.format(nil, nil, nil,tostring(math.random(10, 23)) .."\n") +-- end + +-- Wrk calls a function name delay to get the delay between requests (in ms) +function delay() + return delay_val +end + +function response(status, headers, body) + -- io.write(string.format("%s: %s\n", status, body)) +end + +-- Done Phase + +-- Called when complete, presenting aggregate results +function done(summary, latency, requests) + io.write("Percentile, Latency\n"); + for i = 1, 99 do + io.write(string.format("%d, %d\n", i, latency:percentile(i))) + end +end + + + diff --git a/runtime/tests/raw_utilization/test_mixed_preemption.json b/runtime/tests/raw_utilization/test_mixed_preemption.json new file mode 100644 index 0000000..cbd3b0c --- /dev/null +++ b/runtime/tests/raw_utilization/test_mixed_preemption.json @@ -0,0 +1,70 @@ +{ + "active": "yes", + "name": "fibonacci_10", + "path": "fibonacci_wasm.so", + "port": 10010, + "relative-deadline-us": 4000, + "argsize": 1, + "http-req-headers": [], + "http-req-content-type": "text/plain", + "http-req-size": 1024, + "http-resp-headers": [], + "http-resp-size": 1024, + "http-resp-content-type": "text/plain" +}, +{ + "active": "yes", + "name": "fibonacci_20", + "path": "fibonacci_wasm.so", + "port": 10020, + "relative-deadline-us": 5000, + "argsize": 1, + "http-req-headers": [], + "http-req-content-type": "text/plain", + "http-req-size": 1024, + "http-resp-headers": [], + "http-resp-size": 1024, + "http-resp-content-type": "text/plain" +}, +{ + "active": "yes", + "name": "fibonacci_25", + "path": "fibonacci_wasm.so", + "port": 10025, + "relative-deadline-us": 6000, + "argsize": 1, + "http-req-headers": [], + "http-req-content-type": "text/plain", + "http-req-size": 1024, + "http-resp-headers": [], + "http-resp-size": 1024, + "http-resp-content-type": "text/plain" +}, +{ + "active": "yes", + "name": "fibonacci_30", + "path": "fibonacci_wasm.so", + "port": 10030, + "relative-deadline-us": 8000, + "argsize": 1, + "http-req-headers": [], + "http-req-content-type": "text/plain", + "http-req-size": 1024, + "http-resp-headers": [], + "http-resp-size": 1024, + "http-resp-content-type": "text/plain" +}, +{ + "active": "yes", + "name": "fibonacci_35", + "path": "fibonacci_wasm.so", + "port": 10035, + "relative-deadline-us": 53000, + "argsize": 1, + "http-req-headers": [], + "http-req-content-type": "text/plain", + "http-req-size": 1024, + "http-resp-headers": [], + "http-resp-size": 1024, + "http-resp-content-type": "text/plain" +}