Skip to content

Commit 4ae8b02

Browse files
authored
Enhanced Bash scripts (#384)
* bash enhancements added depth_to_xyz experiment * bash enhancements added depth_to_xyz experiment * updated awsm repo * remove mtdbf env file for now
1 parent de22264 commit 4ae8b02

30 files changed

+751
-400
lines changed

.vscode/c_cpp_properties.json

+22-23
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
{
2-
"configurations": [
3-
{
4-
"name": "Linux",
5-
"intelliSenseMode": "clang-x64",
6-
"includePath": [
7-
"/usr/include/",
8-
"${workspaceFolder}/runtime/include/",
9-
"${workspaceFolder}/runtime/thirdparty/ck/include/",
10-
"${workspaceFolder}/runtime/thirdparty/http-parser/",
11-
"${workspaceFolder}/runtime/thirdparty/jsmn/",
12-
"${workspaceFolder}/awsm/runtime/libc/wasi/include/",
13-
"${workspaceFolder}/libsledge/include"
14-
],
15-
"defines": [
16-
"x86_64",
17-
"_GNU_SOURCE"
18-
],
19-
"cStandard": "c17",
20-
"compilerPath": "/usr/bin/clang"
21-
}
22-
],
23-
"version": 4
24-
}
2+
"configurations": [
3+
{
4+
"name": "Linux",
5+
"intelliSenseMode": "clang-x64",
6+
"includePath": [
7+
"/usr/include/",
8+
"${workspaceFolder}/runtime/include/",
9+
"${workspaceFolder}/runtime/thirdparty/ck/include/",
10+
"${workspaceFolder}/runtime/thirdparty/http-parser/",
11+
"${workspaceFolder}/runtime/thirdparty/jsmn/",
12+
"${workspaceFolder}/awsm/runtime/libc/wasi/include/",
13+
"${workspaceFolder}/libsledge/include"
14+
],
15+
"defines": [
16+
"x86_64",
17+
"_GNU_SOURCE"
18+
],
19+
"cStandard": "c17"
20+
}
21+
],
22+
"version": 4
23+
}

.vscode/settings.json

+21-3
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,25 @@
126126
"local_cleanup_queue.h": "c",
127127
"sandbox_state_transition.h": "c",
128128
"http_session_perf_log.h": "c",
129-
"perf_window.h": "c",
130-
"global_request_scheduler_deque.h": "c"
129+
"traffic_control.h": "c",
130+
"memory_resource": "c",
131+
"memory": "c",
132+
"istream": "c",
133+
"ostream": "c",
134+
"sstream": "c",
135+
"streambuf": "c",
136+
"sandbox_perf_log.h": "c",
137+
"global_request_scheduler_deque.h": "c",
138+
"message.h": "c",
139+
"dbf.h": "c",
140+
"dbf_generic.h": "c",
141+
"tenant_functions.h": "c",
142+
"thread": "c",
143+
"limits": "c",
144+
"algorithm": "c",
145+
"stdio.h": "c",
146+
"get_time.h": "c",
147+
"unistd.h": "c"
131148
},
132149
"files.exclude": {
133150
"**/.git": true,
@@ -189,5 +206,6 @@
189206
"TKILL",
190207
"WASI"
191208
],
192-
"C_Cpp.errorSquiggles": "Enabled"
209+
"C_Cpp.errorSquiggles": "Enabled",
210+
"C_Cpp.default.compilerPath": "/usr/bin/clang"
193211
}

awsm

Submodule awsm updated 141 files

tests/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
res
2+
res-*
23
perf.data
34
perf.data.old
45
samples

tests/bash_libraries/experiment_globals.sh

+10-125
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,20 @@
33
if [ -n "$__experiment_server_globals_sh__" ]; then return; fi
44
__experiment_server_globals_sh__=$(date)
55

6+
# App WASM so files:
7+
declare -r FIBONACCI="fibonacci.wasm.so"
8+
declare -r EKF="gps_ekf.wasm.so"
9+
declare -r CIFAR10="cifar10.wasm.so"
10+
declare -r GOCR="gocr.wasm.so"
11+
declare -r LPD="license_plate_detection.wasm.so"
12+
declare -r RESIZE="resize_image.wasm.so"
13+
declare -r CNN="cnn_face_detection.wasm.so"
14+
615
# The global configs for the scripts
716
declare -gr SERVER_LOG_FILE="perf.log"
817
declare -gr SERVER_HTTP_LOG_FILE="http_perf.log"
918
declare -gr HEY_OPTS="-disable-compression -disable-keepalive -disable-redirects"
1019

11-
# Globals to fill during run_init in run.sh, to use in base and generate_spec
12-
declare -A ports=()
13-
declare -A repl_periods=()
14-
declare -A max_budgets=()
15-
declare -A wasm_paths=()
16-
declare -A expected_execs=()
17-
declare -A deadlines=()
18-
declare -A resp_content_types=()
19-
declare -A arg_opts_hey=()
20-
declare -A arg_opts_lt=()
21-
declare -A args=()
22-
declare -A concurrencies=()
23-
declare -A rpss=()
24-
declare -a workloads=()
25-
declare -A workload_tids=()
26-
declare -A workload_deadlines=()
27-
declare -A workload_vars=()
28-
2920
# Sandbox Perf Log Globals:
3021
declare -ga SANDBOX_METRICS=(total queued uninitialized allocated initialized runnable interrupted preempted running_sys running_user asleep returned complete error)
3122
declare -gA SANDBOX_METRICS_FIELDS=(
@@ -48,6 +39,7 @@ declare -gr SANDBOX_TENANT_NAME_FIELD=2
4839
declare -gr SANDBOX_ROUTE_FIELD=3
4940
declare -gr SANDBOX_CPU_FREQ_FIELD=20
5041
declare -gr SANDBOX_RESPONSE_CODE_FIELD=21
42+
declare -gr SANDBOX_GUARANTEE_TYPE_FIELD=22
5143

5244
# HTTP Session Perf Log Globals:
5345
declare -ga HTTP_METRICS=(http_receive http_sent http_total)
@@ -59,110 +51,3 @@ declare -gA HTTP_METRICS_FIELDS=(
5951
declare -gr HTTP_TENANT_NAME_FIELD=1
6052
declare -gr HTTP_ROUTE_FIELD=2
6153
declare -gr HTTP_CPU_FREQ_FIELD=9
62-
63-
assert_run_experiments_args() {
64-
if (($# != 3)); then
65-
panic "invalid number of arguments \"$#\""
66-
return 1
67-
elif [[ -z "$1" ]]; then
68-
panic "hostname \"$1\" was empty"
69-
return 1
70-
elif [[ ! -d "$2" ]]; then
71-
panic "directory \"$2\" does not exist"
72-
return 1
73-
elif [[ -z "$3" ]]; then
74-
panic "load gen \"$3\" was empty"
75-
return 1
76-
fi
77-
}
78-
79-
assert_process_client_results_args() {
80-
if (($# != 1)); then
81-
error_msg "invalid number of arguments ($#, expected 1)"
82-
return 1
83-
elif ! [[ -d "$1" ]]; then
84-
error_msg "directory $1 does not exist"
85-
return 1
86-
fi
87-
}
88-
89-
assert_process_server_results_args() {
90-
if (($# != 1)); then
91-
panic "invalid number of arguments \"$#\""
92-
return 1
93-
elif [[ ! -d "$1" ]]; then
94-
panic "directory \"$1\" does not exist"
95-
return 1
96-
fi
97-
}
98-
99-
load_value() {
100-
local result=$1
101-
if [ "$result" = "?" ]; then
102-
result=$2
103-
fi
104-
echo "$result"
105-
}
106-
107-
run_init() {
108-
for var in "${VARYING[@]}"; do
109-
for t_idx in "${!TENANT_IDS[@]}"; do
110-
local tenant_id=${TENANT_IDS[$t_idx]}
111-
local tenant=$(printf "%s-%03d" "$tenant_id" "$var")
112-
local port=$((INIT_PORTS[t_idx]+var))
113-
local repl_period=$(load_value ${MTDS_REPL_PERIODS_us[$t_idx]} $var)
114-
local budget=$(load_value ${MTDS_MAX_BUDGETS_us[$t_idx]} $var)
115-
116-
# TENANTS+=("$tenant")
117-
ports+=([$tenant]=$port)
118-
repl_periods+=([$tenant]=$repl_period)
119-
max_budgets+=([$tenant]=$budget)
120-
121-
local t_routes r_expected_execs r_deadlines r_arg_opts_hey r_arg_opts_lt r_args r_loads
122-
123-
IFS=' ' read -r -a t_routes <<< "${ROUTES[$t_idx]}"
124-
IFS=' ' read -r -a r_wasm_paths <<< "${WASM_PATHS[$t_idx]}"
125-
IFS=' ' read -r -a r_expected_execs <<< "${EXPECTED_EXEC_TIMES_us[$t_idx]}"
126-
IFS=' ' read -r -a r_deadlines <<< "${DEADLINES_us[$t_idx]}"
127-
IFS=' ' read -r -a r_resp_content_types <<< "${RESP_CONTENT_TYPES[$t_idx]}"
128-
129-
IFS=' ' read -r -a r_arg_opts_hey <<< "${ARG_OPTS_HEY[$t_idx]}"
130-
IFS=' ' read -r -a r_arg_opts_lt <<< "${ARG_OPTS_LT[$t_idx]}"
131-
IFS=' ' read -r -a r_args <<< "${ARGS[$t_idx]}"
132-
IFS=' ' read -r -a r_loads <<< "${LOADS[$t_idx]}"
133-
134-
for r_idx in "${!t_routes[@]}"; do
135-
local route=${t_routes[$r_idx]}
136-
local wasm_path=${r_wasm_paths[$r_idx]}
137-
local expected=${r_expected_execs[$r_idx]}
138-
local deadline=${r_deadlines[$r_idx]}
139-
local resp_content_type=${r_resp_content_types[$r_idx]}
140-
local arg_opt_hey=${r_arg_opts_hey[$r_idx]}
141-
local arg_opt_lt=${r_arg_opts_lt[$r_idx]}
142-
local arg=${r_args[$r_idx]}
143-
local load=$(load_value ${r_loads[$r_idx]} $var)
144-
145-
local workload="$tenant-$route"
146-
147-
# Divide as float, cast the result to int (Loadtest is okay floats, HEY is not)
148-
local con=$(echo "x = $NWORKERS * $deadline / $expected * $load / 100; x/1" | bc)
149-
local rps=$((1000000 * con / deadline))
150-
# local rps=$(echo "x = 1000000 * $con / $deadline; x/1" | bc)
151-
152-
wasm_paths+=([$workload]=$wasm_path)
153-
expected_execs+=([$workload]=$expected)
154-
deadlines+=([$workload]=$deadline)
155-
resp_content_types+=([$workload]=$resp_content_type)
156-
arg_opts_hey+=([$workload]=$arg_opt_hey)
157-
arg_opts_lt+=([$workload]=$arg_opt_lt)
158-
args+=([$workload]=$arg)
159-
concurrencies+=([$workload]=$con)
160-
rpss+=([$workload]=$rps)
161-
workloads+=("$workload")
162-
workload_tids+=([$workload]=$tenant_id)
163-
workload_deadlines+=([$workload]=$deadline)
164-
workload_vars+=([$workload]=$var)
165-
done
166-
done
167-
done
168-
}

tests/bash_libraries/framework.sh

+9-6
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ __framework_sh__parse_arguments() {
164164
;;
165165
-n=* | --name=*)
166166
echo "Set experiment name to ${i#*=}"
167-
__framework_sh__experiment_name="${i#*=}"
167+
__framework_sh__experiment_name+=" ${i#*=}"
168168
shift
169169
;;
170170
-e=* | --envfile=*)
@@ -190,6 +190,9 @@ __framework_sh__parse_arguments() {
190190
__framework_sh__usage
191191
exit 0
192192
;;
193+
nuclio | Nuclio)
194+
echo "Running for Nuclio"
195+
;;
193196
*)
194197
echo "$1 is a not a valid option"
195198
__framework_sh__usage
@@ -199,7 +202,7 @@ __framework_sh__parse_arguments() {
199202
done
200203

201204
if [[ -z "$__framework_sh__envfile" ]]; then
202-
if [[ -d "$__framework_sh__application_directory/res/$__framework_sh__experiment_name/" ]]; then
205+
if [[ -d "$__framework_sh__application_directory/res-$__framework_sh__role/$__framework_sh__experiment_name/" ]]; then
203206
echo "Experiment $__framework_sh__experiment_name already exists. Pick a unique name!"
204207
exit 1
205208
fi
@@ -209,8 +212,8 @@ __framework_sh__parse_arguments() {
209212
exit 1
210213
fi
211214
short_name="$(basename "${__framework_sh__envfile/.env/}")"
212-
echo "$__framework_sh__application_directory/res/$__framework_sh__experiment_name/$short_name/"
213-
if [[ -d "$__framework_sh__application_directory/res/$__framework_sh__experiment_name/$short_name/" ]]; then
215+
echo "$__framework_sh__application_directory/res-$__framework_sh__role/$__framework_sh__experiment_name/$short_name/"
216+
if [[ -d "$__framework_sh__application_directory/res-$__framework_sh__role/$__framework_sh__experiment_name/$short_name/" ]]; then
214217
echo "Variant $short_name was already run in experiment ${__framework_sh__experiment_name}."
215218
exit 1
216219
fi
@@ -469,8 +472,8 @@ __framework_sh__run_both() {
469472
__framework_sh__create_and_export_results_directory() {
470473
local -r subdirectory=${1:-""}
471474

472-
local dir="$__framework_sh__application_directory/res/$__framework_sh__experiment_name"
473-
# local dir="$__framework_sh__application_directory/res/$__framework_sh__experiment_name/$subdirectory"
475+
local dir="$__framework_sh__application_directory/res-$__framework_sh__role/$__framework_sh__experiment_name"
476+
# local dir="$__framework_sh__application_directory/res-$__framework_sh__role/$__framework_sh__experiment_name/$subdirectory"
474477

475478
mkdir -p "$dir" || {
476479
panic "mkdir -p $dir"

tests/bash_libraries/generate_spec_json.sh

+25-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,30 @@
11
# shellcheck shell=bash
2-
# shellcheck disable=SC2154
2+
# shellcheck disable=SC2154,SC2155
33
if [ -n "$__generate_spec_json_sh__" ]; then return; fi
44
__generate_spec_json_sh__=$(date)
55

6+
jq_admin_spec() {
7+
jq ". + {\
8+
\"name\": \"Admin\",\
9+
\"port\": 55555,\
10+
\"replenishment-period-us\": 0,\
11+
\"max-budget-us\": 0,\
12+
\"reservation-percentile\": 0,\
13+
\"routes\": [\
14+
.routes[] + {\
15+
\"route\": \"/admin\",\
16+
\"admissions-percentile\": 50,\
17+
\"expected-execution-us\": 1000,\
18+
\"relative-deadline-us\": 10000},\
19+
.routes[] + {\
20+
\"route\": \"/terminator\",\
21+
\"admissions-percentile\": 50,\
22+
\"expected-execution-us\": 1000,\
23+
\"relative-deadline-us\": 10000}\
24+
]\
25+
}" < "./template.json" > "./result_admin.json"
26+
}
27+
628
generate_spec_json() {
729
printf "Generating 'spec.json'\n"
830

@@ -13,12 +35,14 @@ generate_spec_json() {
1335
local port=${ports[$tenant]}
1436
local repl_period=${repl_periods[$tenant]}
1537
local budget=${max_budgets[$tenant]}
38+
local reservation=${reservations[$tenant]}
1639

1740
jq_str=". + {
1841
\"name\": \"$tenant\",\
1942
\"port\": $port,\
2043
\"replenishment-period-us\": $repl_period,\
2144
\"max-budget-us\": $budget,\
45+
\"reservation-percentile\": $reservation,\
2246
\"routes\": ["
2347

2448
local t_routes

0 commit comments

Comments
 (0)