Fix gocr hey (#256)

* chore: Update CMSIS

* fix: source missing framework dep

* feat: enable gocr in deadline description

* feat: gocr workload mix realworld

* chore: update sod submodule

* chore: Add jq to Dockerfile

* feat: framework cleanup
master
Sean McBride 4 years ago committed by GitHub
parent 56c39c9361
commit d8f01eac21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -47,6 +47,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
fonts-roboto \
gnuplot \
imagemagick \
jq \
libz3-4 \
netpbm \
pango1.0-tools \

@ -5,20 +5,20 @@ __framework_sh__=$(date)
#
# This framework simplifies the scripting of experiments.
#
# It is designed around the idea of static experiments composed of one or more variants expressed by
# environment variables written to .env files. The default behavior is localhost mode, which runs a background
# It is designed around the idea of static experiments composed of one or more variants expressed by
# environment variables written to .env files. The default behavior is localhost mode, which runs a background
# server daemon and then execute a client driver script. If multiple .env files are defined, the framework
# automatically sets environment variables, starts the runtime as a background process, executes the client driver,
# automatically sets environment variables, starts the runtime as a background process, executes the client driver,
# stops the runtime, and clears the environment variables. The framework allows you to run the same logic on separate
# client and server hosts. It also provides various options to run under perf, gdb, valgrind, etc.
#
# To keep experiments relatively uniform, I suggest adding a single run.sh file inside your experiment.
#
# Your run.sh file should be started with the following snippet, which sources the framework.sh file
# and delegates all external arguments to the framework via the framework_init function. The first few lines are
# Your run.sh file should be started with the following snippet, which sources the framework.sh file
# and delegates all external arguments to the framework via the framework_init function. The first few lines are
# used to temporary add the directory containing BASH library scripts to your PATH environment variable. You may
# need to modify __run_sh__bash_libraries_relative_path to adjust the relative path depending on the location
# of your experimental directory.
# of your experimental directory.
#
###############################################################################################################################
# #!/bin/bash
@ -32,15 +32,15 @@ __framework_sh__=$(date)
# framework_init "$@"
###############################################################################################################################
#
# Use chmod +x run.sh to make your script executable, and then run ./run.sh --help to test it.
# Use chmod +x run.sh to make your script executable, and then run ./run.sh --help to test it.
# You should see help information if successful.
#
# At this point, your script can run the server with defaults usings the --debug, --perf, --serve, and --valgrind
#
# To run a client or the default localhost mode that runs a client and a server on the same machine, you have to
# To run a client or the default localhost mode that runs a client and a server on the same machine, you have to
# implement a function called experiment_client in run.sh above your call to framework_init.
#
# This function receives two arguments:
# This function receives two arguments:
# - a results directory where you should intermediate files and reports / charts
# - a target hostname where you should target requests
#
@ -71,6 +71,8 @@ __framework_sh__=$(date)
source "fn_exists.sh" || exit 1
source "path_join.sh" || exit 1
source "panic.sh" || exit 1
source "type_checks.sh" || exit 1
source "validate_dependencies.sh" || exit 1
__framework_sh__usage() {
echo "$0 [options...]"
@ -363,33 +365,34 @@ __framework_sh__run_client() {
}
__framework_sh__load_env_file() {
local envfile="$1"
if [[ -n "$envfile" ]] && [[ -f "$envfile" ]]; then
while read -r line; do
echo export "${line?}"
export "${line?}"
done < "$envfile"
fi
local envfile="${1:?envfile not defined}"
[[ ! -f "$envfile" ]] && echo "envfile not found" && return 1
local short_name
short_name="$(basename "${envfile/.env/}")"
printf "Running %s\n" "$short_name"
while read -r line; do
echo export "${line?}"
export "${line?}"
done < "$envfile"
__framework_sh__create_and_export_results_directory "$short_name"
}
__framework_sh__unset_env_file() {
local envfile="$1"
if [[ -f "$envfile" ]]; then
while read -r line; do
echo unset "${line//=*/}"
unset "${line//=*/}"
done < "$envfile"
fi
}
local envfile="${1:?envfile not defined}"
[[ ! -f "$envfile" ]] && echo "envfile not found" && return 1
__framework_sh__run_env() {
local envfile="$1"
local short_name
while read -r line; do
echo unset "${line//=*/}"
unset "${line//=*/}"
done < "$envfile"
}
short_name="$(basename "${envfile/.env/}")"
printf "Running %s\n" "$short_name"
__framework_sh__run_both_env() {
local envfile="${1:?envfile not defined}"
__framework_sh__load_env_file "$envfile"
__framework_sh__create_and_export_results_directory "$short_name"
__framework_sh__run_server background || {
panic "Error calling __framework_sh__run_server"
@ -416,12 +419,12 @@ __framework_sh__run_both() {
shopt -s nullglob
if [[ -n "$__framework_sh__envfile" ]]; then
__framework_sh__run_env "$__framework_sh__envfile"
__framework_sh__run_both_env "$__framework_sh__envfile"
else
local -i envfiles_found=0
for envfile in "$__framework_sh__application_directory"/*.env; do
((envfiles_found++))
__framework_sh__run_env "$envfile"
__framework_sh__run_both_env "$envfile"
done
((envfiles_found == 0)) && {
echo "No *.env files found. Nothing to run!"
@ -435,13 +438,8 @@ __framework_sh__run_both() {
# Optionally accepts a subdirectory
# This is intended to namespace distinct runtime configs under a single namespace
__framework_sh__create_and_export_results_directory() {
if (($# > 1)); then
printf "[ERR]\n"
panic "Invalid number of arguments. Saw $#. Expected 0 or 1."
return 1
fi
local -r subdirectory=${1:-""}
local dir="$__framework_sh__application_directory/res/$__framework_sh__experiment_name/$subdirectory"
mkdir -p "$dir" || {

@ -0,0 +1,42 @@
# shellcheck shell=bash
# Example: Be sure to not set the -i attribute until after validating the content
# local -r second=${2:?second not set}
# check_number second || return 1
# local -i second
check_number() {
local arg=${1:?arg not set}
# echo "${arg_raw}: ${!arg_raw}"
# A non-numeric string seems to coerce to 0
((arg == 0)) && [[ ${!arg} != "0" ]] && echo "$arg contains ${!arg}, which is not a valid number" && return 1
return 0
}
check_file() {
local arg_raw=${1:?arg not set}
local -n arg="$arg_raw"
[[ ! -f "$arg" ]] && echo "${arg_raw} contains $arg, which is not a valid file" && return 1
return 0
}
check_nameref() {
# Namerefs automatically transitively resolve, so we have to use indirect expansion to get the name of the intermediate variable name
local nameref_name=${1:?arg not set}
local -n nameref="$nameref_name"
local nameref_value=${!nameref}
[[ ! -v nameref ]] && echo "nameref $nameref_name contains $nameref_value, which does not resolve to variable" && return 1
return 0
}
check_argc() {
local -i expected_argc="$1"
local argv="$2"
local -i actual_argc="${#argv}"
((expected_argc != actual_argc)) && echo "expected ${expected_argc} received ${actual_argc}" && return 1
return 0
}

File diff suppressed because one or more lines are too long

@ -13,10 +13,10 @@ source panic.sh || exit 1
source path_join.sh || exit 1
source validate_dependencies.sh || exit 1
# TODO: Excluding gocr because of difficulty used gocr with hey
validate_dependencies awk hey jq
# Please keep the element ordered alphabetically!
# declare -a workloads=(ekf resize lpd gocr)
declare -a workloads=(ekf lpd resize cifar10)
declare -a workloads=(cifar10 ekf gocr lpd resize)
declare -a multiples=(1.5 1.6 1.7 1.8 1.9 2.0)
profile() {
@ -35,8 +35,8 @@ profile() {
hey -disable-compression -disable-keepalive -disable-redirects -n 256 -c 1 -cpus 1 -t 0 -o csv -m GET -D "./lpd/Cars0.png" "http://${hostname}:10002" > /dev/null
printf "[lpd: OK]\n"
# gocr - Hit error. Commented out temporarily
# hey -disable-compression -disable-keepalive -disable-redirects -n 256 -c 1 -cpus 1 -t 0 -o csv -m GET -D "./gocr/hyde.pnm" "http://${hostname}:10003" > /dev/null
# gocr
hey -disable-compression -disable-keepalive -disable-redirects -n 256 -c 1 -cpus 1 -t 0 -o csv -m GET -D "./gocr/hyde.pnm" "http://${hostname}:10003" > /dev/null
printf "[gocr: OK]\n"
# cifar10

File diff suppressed because one or more lines are too long

@ -1,24 +1,30 @@
500,ekf_1.5
500,ekf_1.6
500,ekf_1.7
500,ekf_1.8
500,ekf_1.9
500,ekf_2.0
25,cifar10_1.5
25,cifar10_1.6
25,cifar10_1.7
25,cifar10_1.8
25,cifar10_1.9
25,cifar10_2.0
5,lpd_1.5
5,lpd_1.6
5,lpd_1.7
5,lpd_1.8
5,lpd_1.9
5,lpd_2.0
1,resize_1.5
1,resize_1.6
1,resize_1.7
1,resize_1.8
1,resize_1.9
1,resize_2.0
100,cifar10_1.5
100,cifar10_1.6
100,cifar10_1.7
100,cifar10_1.8
100,cifar10_1.9
100,cifar10_2.0
1000,ekf_1.5
1000,ekf_1.6
1000,ekf_1.7
1000,ekf_1.8
1000,ekf_1.9
1000,ekf_2.0
1,gocr_1.5
1,gocr_1.6
1,gocr_1.7
1,gocr_1.8
1,gocr_1.9
1,gocr_2.0
24,lpd_1.5
24,lpd_1.6
24,lpd_1.7
24,lpd_1.8
24,lpd_1.9
24,lpd_2.0
3,resize_1.5
3,resize_1.6
3,resize_1.7
3,resize_1.8
3,resize_1.9
3,resize_2.0

1 500 100 ekf_1.5 cifar10_1.5
2 500 100 ekf_1.6 cifar10_1.6
3 500 100 ekf_1.7 cifar10_1.7
4 500 100 ekf_1.8 cifar10_1.8
5 500 100 ekf_1.9 cifar10_1.9
6 500 100 ekf_2.0 cifar10_2.0
7 25 1000 cifar10_1.5 ekf_1.5
8 25 1000 cifar10_1.6 ekf_1.6
9 25 1000 cifar10_1.7 ekf_1.7
10 25 1000 cifar10_1.8 ekf_1.8
11 25 1000 cifar10_1.9 ekf_1.9
12 25 1000 cifar10_2.0 ekf_2.0
13 5 1 lpd_1.5 gocr_1.5
14 5 1 lpd_1.6 gocr_1.6
15 5 1 lpd_1.7 gocr_1.7
16 5 1 lpd_1.8 gocr_1.8
17 5 1 lpd_1.9 gocr_1.9
18 5 1 lpd_2.0 gocr_2.0
19 1 24 resize_1.5 lpd_1.5
20 1 24 resize_1.6 lpd_1.6
21 1 24 resize_1.7 lpd_1.7
22 1 24 resize_1.8 lpd_1.8
23 1 24 resize_1.9 lpd_1.9
24 1 24 resize_2.0 lpd_2.0
25 3 resize_1.5
26 3 resize_1.6
27 3 resize_1.7
28 3 resize_1.8
29 3 resize_1.9
30 3 resize_2.0

@ -1,5 +1,8 @@
#!/bin/bash
# Needed for trimming trailing "deadline description" suffix. lpd_1.8 -> lpd
shopt -s extglob
# This experiment is intended to document how the level of concurrent requests influence the latency, throughput, and success/failure rate
# Success - The percentage of requests that complete by their deadlines
# TODO: Does this handle non-200s?
@ -28,10 +31,11 @@ declare -A port=()
# test="ekf_12223.23343"
# ${test%%_+([[:digit:]]).+([[:digit:]])}
declare -Ar body=(
[cifar10]="-D ./cifar10/airplane1.bmp"
[ekf]="-D ./ekf/ekf_raw.dat"
[resize]="-D ./resize/shrinking_man_large.jpg"
[gocr]="-D ./gocr/hyde.pnm"
[lpd]="-D ./lpd/Cars0.png"
[cifar10]="-D ./cifar10/airplane1.bmp"
[resize]="-D ./resize/shrinking_man_large.jpg"
)
initialize_globals() {
@ -97,11 +101,11 @@ run_experiments() {
fi
# TODO: Check that workload is in spec.json
local -ir batch_size=10
local -ir batch_size=1
local -i batch_id=0
local -i roll=0
local -ir total_iterations=10000
local -ir worker_max=5
local -ir worker_max=30
local pids
printf "Running Experiments: "
@ -110,14 +114,17 @@ run_experiments() {
for ((i = 0; i < total_iterations; i += batch_size)); do
# Block waiting for a worker to finish if we are at our max
while (($(pgrep --count hey) >= worker_max)); do
#shellcheck disable=SC2046
wait -n $(pgrep hey | tr '\n' ' ')
done
roll=$((RANDOM % total))
((batch_id++))
for workload in "${workloads[@]}"; do
shortname="${workload%%_+([[:digit:]]).+([[:digit:]])}"
if ((roll >= floor[$workload] && roll < floor[$workload] + length[$workload])); then
workload_class=$(echo "$workload"| cut -d'_' -f 1)
hey -disable-compression -disable-keepalive -disable-redirects -n $batch_size -c 1 -cpus 1 -t 0 -o csv -m GET ${body[$workload_class]} "http://${hostname}:${port[$workload]}" > /dev/null 2> /dev/null &
# We require word splitting on the value returned by the body associative array
#shellcheck disable=SC2086
hey -disable-compression -disable-keepalive -disable-redirects -n $batch_size -c 1 -cpus 1 -t 0 -o csv -m GET ${body[$shortname]} "http://${hostname}:${port[$workload]}" > /dev/null 2> /dev/null &
break
fi
done
@ -130,16 +137,13 @@ run_experiments() {
}
process_results() {
if (($# != 1)); then
error_msg "invalid number of arguments ($#, expected 1)"
return 1
elif ! [[ -d "$1" ]]; then
local -r results_directory="${1:?results_directory not set}"
if ! [[ -d "$results_directory" ]]; then
error_msg "directory $1 does not exist"
return 1
fi
local -r results_directory="$1"
printf "Processing Results: "
local -a metrics=(total queued initializing runnable running blocked returned)
@ -210,6 +214,9 @@ process_results() {
# Delete scratch file used for sorting/counting
# rm -rf "$results_directory/$workload/memalloc_sorted.csv"
# Delete directory
# rm -rf "${results_directory:?}/${workload:?}"
done
# Transform csvs to dat files for gnuplot

@ -99,8 +99,8 @@
"name": "ekf_1.5",
"path": "ekf_wasm.so",
"port": 10000,
"expected-execution-us": 36,
"relative-deadline-us": 54,
"expected-execution-us": 158,
"relative-deadline-us": 237,
"argsize": 1,
"http-req-headers": [],
"http-req-content-type": "application/octet-stream",
@ -115,8 +115,8 @@
"name": "ekf_1.6",
"path": "ekf_wasm.so",
"port": 10001,
"expected-execution-us": 36,
"relative-deadline-us": 58,
"expected-execution-us": 158,
"relative-deadline-us": 253,
"argsize": 1,
"http-req-headers": [],
"http-req-content-type": "application/octet-stream",
@ -131,8 +131,8 @@
"name": "ekf_1.7",
"path": "ekf_wasm.so",
"port": 10002,
"expected-execution-us": 36,
"relative-deadline-us": 61,
"expected-execution-us": 158,
"relative-deadline-us": 269,
"argsize": 1,
"http-req-headers": [],
"http-req-content-type": "application/octet-stream",
@ -147,8 +147,8 @@
"name": "ekf_1.8",
"path": "ekf_wasm.so",
"port": 10003,
"expected-execution-us": 36,
"relative-deadline-us": 65,
"expected-execution-us": 158,
"relative-deadline-us": 284,
"argsize": 1,
"http-req-headers": [],
"http-req-content-type": "application/octet-stream",
@ -163,8 +163,8 @@
"name": "ekf_1.9",
"path": "ekf_wasm.so",
"port": 10004,
"expected-execution-us": 36,
"relative-deadline-us": 68,
"expected-execution-us": 158,
"relative-deadline-us": 300,
"argsize": 1,
"http-req-headers": [],
"http-req-content-type": "application/octet-stream",
@ -179,8 +179,8 @@
"name": "ekf_2.0",
"path": "ekf_wasm.so",
"port": 10005,
"expected-execution-us": 36,
"relative-deadline-us": 72,
"expected-execution-us": 158,
"relative-deadline-us": 316,
"argsize": 1,
"http-req-headers": [],
"http-req-content-type": "application/octet-stream",
@ -190,13 +190,109 @@
"http-resp-content-type": "application/octet-stream",
"admissions-percentile": 90
},
{
"active": true,
"name": "gocr_1.5",
"path": "gocr_wasm.so",
"port": 10006,
"expected-execution-us": 461831,
"relative-deadline-us": 692746,
"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",
"admissions-percentile": 90
},
{
"active": true,
"name": "gocr_1.6",
"path": "gocr_wasm.so",
"port": 10007,
"expected-execution-us": 461831,
"relative-deadline-us": 738930,
"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",
"admissions-percentile": 90
},
{
"active": true,
"name": "gocr_1.7",
"path": "gocr_wasm.so",
"port": 10008,
"expected-execution-us": 461831,
"relative-deadline-us": 785113,
"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",
"admissions-percentile": 90
},
{
"active": true,
"name": "gocr_1.8",
"path": "gocr_wasm.so",
"port": 10009,
"expected-execution-us": 461831,
"relative-deadline-us": 831296,
"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",
"admissions-percentile": 90
},
{
"active": true,
"name": "gocr_1.9",
"path": "gocr_wasm.so",
"port": 10010,
"expected-execution-us": 461831,
"relative-deadline-us": 877479,
"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",
"admissions-percentile": 90
},
{
"active": true,
"name": "gocr_2.0",
"path": "gocr_wasm.so",
"port": 10011,
"expected-execution-us": 461831,
"relative-deadline-us": 923662,
"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",
"admissions-percentile": 90
},
{
"active": true,
"name": "lpd_1.5",
"path": "lpd_wasm.so",
"port": 10006,
"expected-execution-us": 15686,
"relative-deadline-us": 23529,
"port": 10012,
"expected-execution-us": 31597,
"relative-deadline-us": 47396,
"argsize": 1,
"http-req-headers": [],
"http-req-content-type": "image/jpeg",
@ -210,9 +306,9 @@
"active": true,
"name": "lpd_1.6",
"path": "lpd_wasm.so",
"port": 10007,
"expected-execution-us": 15686,
"relative-deadline-us": 25098,
"port": 10013,
"expected-execution-us": 31597,
"relative-deadline-us": 50555,
"argsize": 1,
"http-req-headers": [],
"http-req-content-type": "image/jpeg",
@ -226,9 +322,9 @@
"active": true,
"name": "lpd_1.7",
"path": "lpd_wasm.so",
"port": 10008,
"expected-execution-us": 15686,
"relative-deadline-us": 26666,
"port": 10014,
"expected-execution-us": 31597,
"relative-deadline-us": 53715,
"argsize": 1,
"http-req-headers": [],
"http-req-content-type": "image/jpeg",
@ -242,9 +338,9 @@
"active": true,
"name": "lpd_1.8",
"path": "lpd_wasm.so",
"port": 10009,
"expected-execution-us": 15686,
"relative-deadline-us": 28235,
"port": 10015,
"expected-execution-us": 31597,
"relative-deadline-us": 56875,
"argsize": 1,
"http-req-headers": [],
"http-req-content-type": "image/jpeg",
@ -258,9 +354,9 @@
"active": true,
"name": "lpd_1.9",
"path": "lpd_wasm.so",
"port": 10010,
"expected-execution-us": 15686,
"relative-deadline-us": 29803,
"port": 10016,
"expected-execution-us": 31597,
"relative-deadline-us": 60034,
"argsize": 1,
"http-req-headers": [],
"http-req-content-type": "image/jpeg",
@ -274,9 +370,9 @@
"active": true,
"name": "lpd_2.0",
"path": "lpd_wasm.so",
"port": 10011,
"expected-execution-us": 15686,
"relative-deadline-us": 31372,
"port": 10017,
"expected-execution-us": 31597,
"relative-deadline-us": 63194,
"argsize": 1,
"http-req-headers": [],
"http-req-content-type": "image/jpeg",
@ -290,9 +386,9 @@
"active": true,
"name": "resize_1.5",
"path": "resize_wasm.so",
"port": 10012,
"expected-execution-us": 131861,
"relative-deadline-us": 197792,
"port": 10018,
"expected-execution-us": 138903,
"relative-deadline-us": 208354,
"argsize": 1,
"http-req-headers": [],
"http-req-content-type": "image/jpeg",
@ -306,9 +402,9 @@
"active": true,
"name": "resize_1.6",
"path": "resize_wasm.so",
"port": 10013,
"expected-execution-us": 131861,
"relative-deadline-us": 210978,
"port": 10019,
"expected-execution-us": 138903,
"relative-deadline-us": 222245,
"argsize": 1,
"http-req-headers": [],
"http-req-content-type": "image/jpeg",
@ -322,9 +418,9 @@
"active": true,
"name": "resize_1.7",
"path": "resize_wasm.so",
"port": 10014,
"expected-execution-us": 131861,
"relative-deadline-us": 224164,
"port": 10020,
"expected-execution-us": 138903,
"relative-deadline-us": 236135,
"argsize": 1,
"http-req-headers": [],
"http-req-content-type": "image/jpeg",
@ -338,9 +434,9 @@
"active": true,
"name": "resize_1.8",
"path": "resize_wasm.so",
"port": 10015,
"expected-execution-us": 131861,
"relative-deadline-us": 237350,
"port": 10021,
"expected-execution-us": 138903,
"relative-deadline-us": 250025,
"argsize": 1,
"http-req-headers": [],
"http-req-content-type": "image/jpeg",
@ -354,9 +450,9 @@
"active": true,
"name": "resize_1.9",
"path": "resize_wasm.so",
"port": 10016,
"expected-execution-us": 131861,
"relative-deadline-us": 250536,
"port": 10022,
"expected-execution-us": 138903,
"relative-deadline-us": 263916,
"argsize": 1,
"http-req-headers": [],
"http-req-content-type": "image/jpeg",
@ -370,9 +466,9 @@
"active": true,
"name": "resize_2.0",
"path": "resize_wasm.so",
"port": 10017,
"expected-execution-us": 131861,
"relative-deadline-us": 263722,
"port": 10023,
"expected-execution-us": 138903,
"relative-deadline-us": 277806,
"argsize": 1,
"http-req-headers": [],
"http-req-content-type": "image/jpeg",

@ -1 +1 @@
Subproject commit 3507d3d0001db45eedbb65072f5fe7cad8bcb59b
Subproject commit 9e01b5a5914d3456c3018b3265d74a01656d10bd

@ -1 +1 @@
Subproject commit 2f57d46df4074be9374f6021cef955b17702380e
Subproject commit 9d086b344102b7995f094a4e99b63f17cd446348
Loading…
Cancel
Save