fix: error handling

pull/385/head
emil 1 year ago
parent fdf75b4e8f
commit 11d1484701

@ -21,7 +21,7 @@ http_router_init(http_router_t *router, size_t capacity)
static inline int
http_router_add_route(http_router_t *router, struct route_config *config, struct module *module,
struct module *pre_module)
struct module *module_proprocess)
{
assert(router != NULL);
assert(config != NULL);
@ -41,8 +41,7 @@ http_router_add_route(http_router_t *router, struct route_config *config, struct
#ifdef EXECUTION_REGRESSION
/* Execution Regression setup */
assert(pre_module);
route.pre_module = pre_module;
route.module_proprocess = module_proprocess;
route.regr_model.bias = config->model_bias / 1000.0;
route.regr_model.scale = config->model_scale / 1000.0;
route.regr_model.num_of_param = config->model_num_of_param;

@ -21,12 +21,12 @@ struct route {
char *route;
struct http_route_total metrics;
struct module *module;
struct module *pre_module;
/* HTTP State */
uint32_t relative_deadline_us;
uint64_t relative_deadline; /* cycles */
char *response_content_type;
struct execution_histogram execution_histogram;
struct perf_window latency;
struct module *module_proprocess;
struct regression_model regr_model;
};

@ -12,9 +12,9 @@ enum route_config_member
{
route_config_member_route,
route_config_member_path,
route_config_member_path_premodule,
route_config_member_admissions_percentile,
route_config_member_relative_deadline_us,
route_config_member_path_preprocess,
route_config_member_model_bias,
route_config_member_model_scale,
route_config_member_model_num_of_param,
@ -27,9 +27,9 @@ enum route_config_member
struct route_config {
char *route;
char *path;
char *path_premodule;
uint8_t admissions_percentile;
uint32_t relative_deadline_us;
char *path_preprocess;
uint32_t model_bias;
uint32_t model_scale;
uint32_t model_num_of_param;
@ -54,14 +54,16 @@ route_config_print(struct route_config *config)
{
printf("[Route] Route: %s\n", config->route);
printf("[Route] Path: %s\n", config->path);
printf("[Route] Path of Preprocessing Module: %s\n", config->path_premodule);
printf("[Route] Admissions Percentile: %hhu\n", config->admissions_percentile);
printf("[Route] Relative Deadline (us): %u\n", config->relative_deadline_us);
printf("[Route] HTTP Response Content Type: %s\n", config->http_resp_content_type);
#ifdef EXECUTION_HISTOGRAM
printf("[Route] Path of Preprocessing Module: %s\n", config->path_preprocess);
printf("[Route] Model Bias: %u\n", config->model_bias);
printf("[Route] Model Scale: %u\n", config->model_scale);
printf("[Route] Model Num of Parameters: %u\n", config->model_num_of_param);
printf("[Route] Model Betas: [%u, %u]\n", config->model_beta1, config->model_beta2);
printf("[Route] HTTP Response Content Type: %s\n", config->http_resp_content_type);
#endif
}
/**
@ -73,7 +75,7 @@ static inline int
route_config_validate(struct route_config *config, bool *did_set)
{
if (did_set[route_config_member_route] == false) {
fprintf(stderr, "path field is required\n");
fprintf(stderr, "route field is required\n");
return -1;
}
@ -82,19 +84,14 @@ route_config_validate(struct route_config *config, bool *did_set)
return -1;
}
if (did_set[route_config_member_path_premodule] == false) {
fprintf(stderr, "path_premodule field is required\n");
return -1;
}
if (did_set[route_config_member_http_resp_content_type] == false) {
debuglog("http_resp_content_type not set, defaulting to text/plain\n");
config->http_resp_content_type = "text/plain";
}
if (scheduler != SCHEDULER_FIFO) {
if (scheduler != SCHEDULER_FIFO && scheduler != SCHEDULER_SJF) {
if (did_set[route_config_member_relative_deadline_us] == false) {
fprintf(stderr, "relative_deadline_us is required\n");
fprintf(stderr, "relative_deadline_us is required for the selected scheduler\n");
return -1;
}
@ -103,20 +100,69 @@ route_config_validate(struct route_config *config, bool *did_set)
(uint32_t)RUNTIME_RELATIVE_DEADLINE_US_MAX, config->relative_deadline_us);
return -1;
}
}
#ifdef EXECUTION_HISTOGRAM
if (config->admissions_percentile > 99 || config->admissions_percentile < 50) {
fprintf(stderr, "admissions-percentile must be > 50 and <= 99 but was %u, defaulting to 70\n",
config->admissions_percentile);
config->admissions_percentile = 70;
}
#endif
#ifdef EXECUTION_REGRESSION
if (did_set[route_config_member_path_preprocess] == false) {
fprintf(stderr, "model path_preprocess field is required. Put zero if just default preprocessing\n");
return -1;
} else if (strcmp(config->path_preprocess, "0") == 0) {
config->path_preprocess = NULL;
}
if (did_set[route_config_member_model_bias] == false) {
fprintf(stderr, "model bias field is required\n");
return -1;
}
if (did_set[route_config_member_model_scale] == false) {
fprintf(stderr, "model scale field is required\n");
return -1;
}
if (did_set[route_config_member_model_num_of_param] == false) {
fprintf(stderr, "model num_of_param field is required\n");
return -1;
}
if (did_set[route_config_member_model_beta1] == false) {
fprintf(stderr, "model beta1 field is required\n");
return -1;
}
if (did_set[route_config_member_model_beta2] == false) {
fprintf(stderr, "model beta2 field is required. Put zero for just default preprocessing\n");
return -1;
}
#ifdef ADMISSIONS_CONTROL
if (did_set[route_config_member_admissions_percentile] == false) {
fprintf(stderr, "admissions_percentile is required\n");
if (config->model_num_of_param < 1) {
fprintf(stderr, "model num_of_param must be at least 1 (just default preprocessing)\n");
return -1;
} else if (config->model_num_of_param == 1) {
if (config->path_preprocess) {
fprintf(stderr, "model_num_of_param cannot be 1 when using tenant preprocessing\n");
return -1;
}
if (config->admissions_percentile > 99 || config->admissions_percentile < 50) {
fprintf(stderr, "admissions-percentile must be > 50 and <= 99 but was %u\n",
config->admissions_percentile);
if (config->model_beta2 != 0) {
fprintf(stderr, "model beta2 must be zero for just default preprocessing\n");
return -1;
}
} else {
/* For now we just support up to two params */
assert(config->model_num_of_param == 2);
if (config->path_preprocess == NULL) {
fprintf(stderr, "model_num_of_param cannot be more than 1 when just default preprocessing\n");
return -1;
}
#endif
}
#endif
return 0;
}

@ -6,17 +6,11 @@
#include "json.h"
#include "route_config.h"
static const char *route_config_json_keys[route_config_member_len] = { "route",
"path",
"path_premodule",
"admissions-percentile",
"relative-deadline-us",
"model-bias",
"model-scale",
"model-num-of-param",
"model-beta1",
"model-beta2",
"http-resp-content-type" };
static const char *route_config_json_keys[route_config_member_len] = {
"route", "path", "admissions-percentile", "relative-deadline-us",
"path_preprocess", "model-bias", "model-scale", "model-num-of-param",
"model-beta1", "model-beta2", "http-resp-content-type"
};
static inline int
route_config_set_key_once(bool *did_set, enum route_config_member member)
@ -66,11 +60,11 @@ route_config_parse(struct route_config *config, const char *json_buf, jsmntok_t
if (route_config_set_key_once(did_set, route_config_member_path) == -1) return -1;
config->path = strndup(json_buf + tokens[i].start, tokens[i].end - tokens[i].start);
} else if (strcmp(key, route_config_json_keys[route_config_member_path_premodule]) == 0) {
} else if (strcmp(key, route_config_json_keys[route_config_member_path_preprocess]) == 0) {
if (!is_nonempty_string(tokens[i], key)) return -1;
if (route_config_set_key_once(did_set, route_config_member_path_premodule) == -1) return -1;
if (route_config_set_key_once(did_set, route_config_member_path_preprocess) == -1) return -1;
config->path_premodule = strndup(json_buf + tokens[i].start, tokens[i].end - tokens[i].start);
config->path_preprocess = strndup(json_buf + tokens[i].start, tokens[i].end - tokens[i].start);
} else if (strcmp(key, route_config_json_keys[route_config_member_admissions_percentile]) == 0) {
if (!has_valid_type(tokens[i], key, JSMN_PRIMITIVE, json_buf)) return -1;
if (route_config_set_key_once(did_set, route_config_member_admissions_percentile) == -1)
@ -89,6 +83,9 @@ route_config_parse(struct route_config *config, const char *json_buf, jsmntok_t
route_config_json_keys[route_config_member_relative_deadline_us],
&config->relative_deadline_us);
if (rc < 0) return -1;
} else if (strcmp(key, "expected-execution-us") == 0) {
if (!has_valid_type(tokens[i], key, JSMN_PRIMITIVE, json_buf)) return -1;
printf("The \"expected-execution-us\" field has been deprecated, so no need.\n");
} else if (strcmp(key, route_config_json_keys[route_config_member_model_bias]) == 0) {
if (!has_valid_type(tokens[i], key, JSMN_PRIMITIVE, json_buf)) return -1;
if (route_config_set_key_once(did_set, route_config_member_model_bias) == -1) return -1;
@ -138,7 +135,7 @@ route_config_parse(struct route_config *config, const char *json_buf, jsmntok_t
tokens[i].end - tokens[i].start);
} else {
fprintf(stderr, "%s is not a valid key\n", key);
// return -1;
return -1;
}
}

@ -45,8 +45,10 @@ tenant_config_print(struct tenant_config *config)
{
printf("[Tenant] Name: %s\n", config->name);
printf("[Tenant] Path: %d\n", config->port);
printf("[Tenant] Replenishment Period (us): %u\n", config->replenishment_period_us);
printf("[Tenant] Max Budget (us): %u\n", config->max_budget_us);
if (scheduler == SCHEDULER_MTDS) {
printf("[Tenant] Replenishment Period (us): %u\n", config->replenishment_period_us);
printf("[Tenant] Max Budget (us): %u\n", config->max_budget_us);
}
printf("[Tenant] Routes Size: %zu\n", config->routes_len);
for (int i = 0; i < config->routes_len; i++) { route_config_print(&config->routes[i]); }
}

@ -96,7 +96,7 @@ tenant_config_parse(struct tenant_config *config, const char *json_buf, jsmntok_
} else {
fprintf(stderr, "%s is not a valid key\n", key);
// return -1;
return -1;
}
}

@ -115,27 +115,30 @@ tenant_alloc(struct tenant_config *config)
assert(module != NULL);
struct module *pre_module = NULL;
struct module *module_proprocess = NULL;
#ifdef EXECUTION_REGRESSION
pre_module = module_database_find_by_path(&tenant->module_db, config->routes[i].path_premodule);
if (pre_module == NULL) {
/* Ownership of path moves here */
pre_module = module_alloc(config->routes[i].path_premodule, PREPROCESS_MODULE);
if (pre_module != NULL) {
module_database_add(&tenant->module_db, pre_module);
config->routes[i].path_premodule = NULL;
if (config->routes[i].path_preprocess) {
module_proprocess = module_database_find_by_path(&tenant->module_db,
config->routes[i].path_preprocess);
if (module_proprocess == NULL) {
/* Ownership of path moves here */
module_proprocess = module_alloc(config->routes[i].path_preprocess, PREPROCESS_MODULE);
if (module_proprocess != NULL) {
module_database_add(&tenant->module_db, module_proprocess);
config->routes[i].path_preprocess = NULL;
}
} else {
free(config->routes[i].path_preprocess);
config->routes[i].path_preprocess = NULL;
}
} else {
free(config->routes[i].path_premodule);
config->routes[i].path_premodule = NULL;
}
assert(pre_module != NULL);
assert(module_proprocess != NULL);
}
#endif
/* Ownership of config's route and http_resp_content_type move here */
int rc = http_router_add_route(&tenant->router, &config->routes[i], module, pre_module);
int rc = http_router_add_route(&tenant->router, &config->routes[i], module, module_proprocess);
if (unlikely(rc != 0)) {
panic("Tenant %s defined %lu routes, but router failed to grow beyond %lu\n", tenant->name,
config->routes_len, tenant->router.capacity);

@ -29,10 +29,12 @@ err:
void
tenant_preprocess(struct http_session *session)
{
/* No tenant preprocessing if the wasm module not provided by the tenant */
if (session->route->module_proprocess == NULL) goto done;
const uint64_t start = __getcycles();
/* Tenant Pre-processing - Extract other useful parameters */
struct sandbox *pre_sandbox = sandbox_alloc(session->route->pre_module, session, session->route,
struct sandbox *pre_sandbox = sandbox_alloc(session->route->module_proprocess, session, session->route,
session->tenant, 1);
if (sandbox_prepare_execution_environment(pre_sandbox)) panic("pre_sandbox environment setup failed");
pre_sandbox->state = SANDBOX_RUNNING_SYS;
@ -62,9 +64,10 @@ tenant_preprocess(struct http_session *session)
sandbox_free_linear_memory(pre_sandbox);
sandbox_free(pre_sandbox);
session->did_preprocessing = true;
const uint64_t end = __getcycles();
session->preprocessing_duration = end - start;
done:
session->did_preprocessing = true;
}
#endif

@ -2,8 +2,6 @@
{
"name": "gwu",
"port": 10000,
"replenishment-period-us": 0,
"max-budget-us": 0,
"routes": [
{
"route": "/rand",

@ -2,8 +2,6 @@
{
"name": "gwu",
"port": 10000,
"replenishment-period-us": 0,
"max-budget-us": 0,
"routes": [
{
"route": "/ekf_first_iter",

@ -2,8 +2,6 @@
{
"name": "gwu",
"port": 10000,
"replenishment-period-us": 0,
"max-budget-us": 0,
"routes": [
{
"route": "/ekf",

@ -24,17 +24,22 @@ generate_spec_json() {
local jq_str
local tenant=$(printf "%s-%03d" "${TENANT_IDS[$t_idx]}" "$var")
local port=${ports[$tenant]}
local repl_period=${repl_periods[$tenant]}
local budget=${max_budgets[$tenant]}
local reservation=${reservations[$tenant]}
jq_str=". + {
\"name\": \"$tenant\",\
\"port\": $port,\
\"replenishment-period-us\": $repl_period,\
\"max-budget-us\": $budget,\
\"reservation-percentile\": $reservation,\
\"routes\": ["
\"port\": $port"
if [ -n "$MTDS_REPL_PERIODS_us" ]; then
repl_period=${repl_periods[$tenant]}
budget=${max_budgets[$tenant]}
jq_str+=",\"replenishment-period-us\": $repl_period,\"max-budget-us\": $budget"
fi
if [ -n "$MTDBF_RESERVATIONS_p" ]; then
reservation=${reservations[$tenant]}
jq_str+=",\"reservation-percentile\": $reservation"
fi
jq_str+=",\"routes\": ["
local t_routes
IFS=' ' read -r -a t_routes <<< ${ROUTES[$t_idx]}
@ -44,26 +49,33 @@ generate_spec_json() {
local workload="$tenant-$route"
local wasm_path=${wasm_paths[$workload]}
local resp_content_type=${resp_content_types[$workload]}
local expected=${expected_execs[$workload]}
local deadline=${deadlines[$workload]}
local model_bias=${model_biases[$workload]}
local model_scale=${model_scales[$workload]}
local model_num_of_param=${model_num_of_params[$workload]}
local model_beta1=${model_beta1s[$workload]}
local model_beta2=${model_beta2s[$workload]}
jq_str+=".routes[] + {\
\"route\": \"/$route\",\
\"path\": \"$wasm_path\",\
\"admissions-percentile\": $ESTIMATIONS_PERCENTILE,\
\"expected-execution-us\": $expected,\
\"relative-deadline-us\": $deadline,\
\"model-bias\": $model_bias,\
\"model-scale\": $model_scale,\
\"model-num-of-param\": $model_num_of_param,\
\"model-beta1\": $model_beta1,\
\"model-beta2\": $model_beta2,\
\"http-resp-content-type\": \"$resp_content_type\"}"
\"http-resp-content-type\": \"$resp_content_type\""
if [ -n "$PREPROCESS_WASM_PATHS" ]; then
local preprocess_wasm_path=${preprocess_wasm_paths[$workload]}
local model_bias=${model_biases[$workload]}
local model_scale=${model_scales[$workload]}
local model_num_of_param=${model_num_of_params[$workload]}
local model_beta1=${model_beta1s[$workload]}
local model_beta2=${model_beta2s[$workload]}
jq_str+=",
\"path_preprocess\": \"$preprocess_wasm_path\",\
\"model-bias\": $model_bias,\
\"model-scale\": $model_scale,\
\"model-num-of-param\": $model_num_of_param,\
\"model-beta1\": $model_beta1,\
\"model-beta2\": $model_beta2"
fi
jq_str+="}"
if [ "$index" != $((${#t_routes[@]}-1)) ]; then
jq_str+=","
@ -75,7 +87,7 @@ generate_spec_json() {
done
done
jq_admin_spec
if [ "$CLIENT_TERMINATE_SERVER" == true ]; then jq_admin_spec; fi
# Merges all of the multiple specs for a single module
jq -s '. | sort_by(.name)' ./result_*.json > "./spec.json"

@ -9,6 +9,7 @@ declare -A repl_periods=()
declare -A max_budgets=()
declare -A reservations=()
declare -A wasm_paths=()
declare -A preprocess_wasm_paths=()
declare -A expected_execs=()
declare -A deadlines=()
declare -A resp_content_types=()
@ -94,6 +95,7 @@ run_init() {
IFS=' ' read -r -a r_dl_to_exec_ratios <<< "${DEADLINE_TO_EXEC_RATIOs[$t_idx]}"
IFS=' ' read -r -a r_resp_content_types <<< "${RESP_CONTENT_TYPES[$t_idx]}"
IFS=' ' read -r -a r_preprocess_wasm_paths <<< "${PREPROCESS_WASM_PATHS[$t_idx]}"
IFS=' ' read -r -a r_model_biases <<< "${MODEL_BIASES[$t_idx]}"
IFS=' ' read -r -a r_model_scales <<< "${MODEL_SCALES[$t_idx]}"
IFS=' ' read -r -a r_model_num_of_params <<< "${MODEL_NUM_OF_PARAMS[$t_idx]}"
@ -112,6 +114,7 @@ run_init() {
local dl_to_exec_ratio=${r_dl_to_exec_ratios[$r_idx]}
local deadline=$((expected*dl_to_exec_ratio/100))
local resp_content_type=${r_resp_content_types[$r_idx]}
local preprocess_wasm_path=${r_preprocess_wasm_paths[$r_idx]}
local model_bias=${r_model_biases[$r_idx]}
local model_scale=${r_model_scales[$r_idx]}
local model_num_of_param=${r_model_num_of_params[$r_idx]}
@ -127,6 +130,7 @@ run_init() {
expected_execs+=([$workload]=$expected)
deadlines+=([$workload]=$deadline)
resp_content_types+=([$workload]=$resp_content_type)
preprocess_wasm_paths+=([$workload]=$preprocess_wasm_path)
model_biases+=([$workload]=$model_bias)
model_scales+=([$workload]=$model_scale)
model_num_of_params+=([$workload]=$model_num_of_param)

@ -2,8 +2,6 @@
{
"name": "gwu",
"port": 10000,
"replenishment-period-us": 0,
"max-budget-us": 0,
"routes": [
{
"route": "/ekf",

@ -13,6 +13,7 @@ export SLEDGE_HTTP_SESSION_PERF_LOG=http_perf.log
# export EXTRA_EXEC_PERCENTILE=10
# The global configs for the scripts
declare -r ADMIN_ACCESS=false
declare -r CLIENT_TERMINATE_SERVER=false
declare -r DURATION_sec=30
declare -r ESTIMATIONS_PERCENTILE=60

@ -1,44 +1,19 @@
[
{
"name": "Admin",
"port": 55555,
"replenishment-period-us": 0,
"max-budget-us": 0,
"reservation-percentile": 0,
"routes": [
{
"route": "/admin",
"path": "fibonacci.wasm.so",
"admissions-percentile": 50,
"expected-execution-us": 1000,
"relative-deadline-us": 10000,
"http-resp-content-type": "text/plain"
},
{
"route": "/terminator",
"path": "fibonacci.wasm.so",
"admissions-percentile": 50,
"expected-execution-us": 1000,
"relative-deadline-us": 10000,
"http-resp-content-type": "text/plain"
}
]
},
{
"name": "cmu-000",
"port": 10000,
"replenishment-period-us": 0,
"max-budget-us": 0,
"reservation-percentile": 0,
"routes": [
{
"route": "/depth_to_xyz",
"path": "depth_to_xyz.wasm.so",
"admissions-percentile": 60,
"expected-execution-us": 950000,
"relative-deadline-us": 4750000,
"relative-deadline-us": 0,
"http-resp-content-type": "image/png"
}
]
],
"replenishment-period-us": 0,
"max-budget-us": 0,
"reservation-percentile": 0
}
]

@ -1,9 +1,6 @@
{
"name": "tenant",
"port": 0,
"replenishment-period-us": 0,
"max-budget-us": 0,
"reservation-percentile": 0,
"routes": [
{
"route": "/route",

@ -2,8 +2,6 @@
{
"name": "gwu",
"port": 10000,
"replenishment-period-us": 0,
"max-budget-us": 0,
"routes": [
{
"route": "/empty",

@ -2,8 +2,6 @@
{
"name": "gwu",
"port": 10010,
"replenishment-period-us": 0,
"max-budget-us": 0,
"routes": [
{
"route": "/fib",
@ -26,8 +24,6 @@
{
"name": "conix",
"port": 10020,
"replenishment-period-us": 0,
"max-budget-us": 0,
"routes": [
{
"route": "/fib",

@ -2,8 +2,6 @@
{
"name": "gwu",
"port": 10030,
"replenishment-period-us": 0,
"max-budget-us": 0,
"routes": [
{
"route": "/fib",

@ -2,8 +2,6 @@
{
"name": "gwu",
"port": 10000,
"replenishment-period-us": 0,
"max-budget-us": 0,
"routes": [
{
"route": "/gocr_72_dpi",

@ -2,8 +2,6 @@
{
"name": "gwu",
"port": 10000,
"replenishment-period-us": 0,
"max-budget-us": 0,
"routes": [
{
"route": "/gocr_mono",

@ -2,8 +2,6 @@
{
"name": "gwu",
"port": 10000,
"replenishment-period-us": 0,
"max-budget-us": 0,
"routes": [
{
"route": "/gocr_1_word",

@ -2,8 +2,6 @@
{
"name": "gwu",
"port": 10000,
"replenishment-period-us": 0,
"max-budget-us": 0,
"routes": [
{
"route": "/gocr",

@ -2,8 +2,6 @@
{
"name": "gwu",
"port": 10000,
"replenishment-period-us": 0,
"max-budget-us": 0,
"routes": [
{
"route": "/gocr",

@ -2,8 +2,6 @@
{
"name": "gwu",
"port": 10000,
"replenishment-period-us": 0,
"max-budget-us": 0,
"routes": [
{
"route": "/gocr",

@ -2,8 +2,6 @@
{
"name": "gwu",
"port": 1337,
"replenishment-period-us": 0,
"max-budget-us": 0,
"routes": [
{
"route": "/index.html",

@ -0,0 +1,102 @@
SLEDGE_BINARY_DIR=../../runtime/bin
HOST?=localhost # pass arguments to change this: make client-lpd HOST=10.10.1.4
# HOST=arena0.andrew.cmu.edu
# HOST=c220g2-011017.wisc.cloudlab.us
PORT0=10000
PORT1=15000
PORT2=20000
PORT3=25000
PORT4=30000
PORT5=35000
PORT6=40000
HEY_OPTS=-disable-compression -disable-keepalive -disable-redirects
default: run
clean:
rm -rf res/*
run:
SLEDGE_SIGALRM_HANDLER=TRIAGED SLEDGE_SCHEDULER=MTDBF SLEDGE_SPINLOOP_PAUSE_ENABLED=true SLEDGE_HTTP_SESSION_PERF_LOG=http_perf.log SLEDGE_SANDBOX_PERF_LOG=perf.log LD_LIBRARY_PATH=${SLEDGE_BINARY_DIR} ${SLEDGE_BINARY_DIR}/sledgert spec.json
debug:
SLEDGE_SCHEDULER=MTDBF SLEDGE_SPINLOOP_PAUSE_ENABLED=false SLEDGE_NWORKERS=18 LD_LIBRARY_PATH=${SLEDGE_BINARY_DIR} gdb ${SLEDGE_BINARY_DIR}/sledgert \
--eval-command="handle SIGUSR1 noprint nostop" \
--eval-command="handle SIGPIPE noprint nostop" \
--eval-command="set pagination off" \
--eval-command="set print pretty" \
--eval-command="run spec.json"
valgrind:
SLEDGE_DISABLE_PREEMPTION=true SLEDGE_NWORKERS=1 LD_LIBRARY_PATH=${SLEDGE_BINARY_DIR} valgrind --leak-check=full --max-stackframe=11150456 --run-libc-freeres=no --run-cxx-freeres=no ${SLEDGE_BINARY_DIR}/sledgert spec.json
client-cnn:
curl -H 'Expect: ' -H "Content-Type: image/jpeg" --data-binary "@input-cnn/faces01.jpg" "${HOST}:${PORT0}/cnn"
client-cifar10:
curl -H 'Expect: ' -H "Content-Type: image/bmp" --data-binary "@input-cifar10/airplane1.bmp" "${HOST}:${PORT1}/cifar10"
client-gocr:
curl -H 'Expect: ' -H "Content-Type: application/octet-stream" --data-binary "@input-gocr/5x8.pnm" "${HOST}:${PORT2}/gocr"
client-lpd:
# curl -H 'Expect: ' -H "Content-Type: image/png" --data-binary "@input-lpd-png/Cars0.png" "${HOST}:${PORT3}/lpd"
curl -H 'Expect: ' -H "Content-Type: image/jpeg" --data-binary "@input-lpd-jpg/Cars0.jpg" "${HOST}:${PORT3}/lpd"
client-resize:
curl -H 'Expect: ' -H "Content-Type: image/jpeg" --data-binary "@input-resize/picsum_512x512_01.jpg" "${HOST}:${PORT4}/resize" --output "out-resize.jpg"
client-ekf:
curl -H 'Expect: ' -H "Content-Type: application/octet-stream" --data-binary "@input-ekf/iter00.dat" "${HOST}:${PORT5}/ekf" --output "out-ekf-iter00.dat"
client-fib-curl:
curl -i -H 'Expect: ' -H "Content-Type: text/plain" "${HOST}:${PORT6}/fib?30"
########################################## Choose a random file to send with curl: ##########################################
client-cnn-random:
@dir="input-cnn"; random_file="$$(ls $$dir | shuf -n 1)"; echo "Random file: $$random_file"; \
curl -s -H 'Expect: ' -H "Content-Type: image/jpeg" --data-binary "@$$dir/$$random_file" "${HOST}:${PORT0}/cnn"
client-cifar10-random:
@dir="input-cifar10"; random_file="$$(ls $$dir | shuf -n 1)"; echo "Random file: $$random_file"; \
curl -s -H 'Expect: ' -H "Content-Type: image/bmp" --data-binary "@$$dir/$$random_file" "${HOST}:${PORT1}/cifar10"
client-gocr-random:
@dir="input-gocr"; random_file="$$(ls $$dir | shuf -n 1)"; echo "Random file: $$random_file"; \
curl -s -H 'Expect: ' -H "Content-Type: application/octet-stream" --data-binary "@$$dir/$$random_file" "${HOST}:${PORT2}/gocr"
client-lpd-random:
# @dir="input-lpd-png"; random_file="$$(ls $$dir | shuf -n 1)"; echo "Random file: $$random_file"; \
# curl -s -H 'Expect: ' -H "Content-Type: image/png" --data-binary "@$$dir/$$random_file" "${HOST}:${PORT3}/lpd"
@dir="input-lpd-jpg"; random_file="$$(ls $$dir | shuf -n 1)"; echo "Random file: $$random_file"; \
curl -s -H 'Expect: ' -H "Content-Type: image/jpeg" --data-binary "@$$dir/$$random_file" "${HOST}:${PORT3}/lpd"
client-resize-random:
@dir="input-resize"; random_file="$$(ls $$dir | shuf -n 1)"; echo "Random file: $$random_file"; \
curl -s -H 'Expect: ' -H "Content-Type: image/jpeg" --data-binary "@$$dir/$$random_file" "${HOST}:${PORT4}/resize" --output "out-resize-$$random_file"
client-ekf-random:
@dir="input-ekf"; random_file="$$(ls $$dir | shuf -n 1)"; echo "Random file: $$random_file"; \
curl -s -H 'Expect: ' -H "Content-Type: application/octet-stream" --data-binary "@$$dir/$$random_file" "${HOST}:${PORT5}/ekf" --output "out-ekf-$$random_file"
#############################################################################################################################
client-fib-once:
echo 30 | http ${HOST}:${PORT6}/fib
# http ${HOST}:${PORT6}/fib?30
client-fib-loadtest:
loadtest -n 10 -c 10 -P 30 "http://${HOST}:${PORT6}/fib"
client-fib-hey:
hey ${HEY_OPTS} -z 10s -c 72 -t 0 -o csv -m POST -d "30\n" "http://${HOST}:${PORT6}/fib"
client-fib-wrk:
wrk -t 1 -c 1 -d 5s -R 1 "http://${HOST}:${PORT6}/fib?30"
client-admin:
echo 5 | http ${HOST}:55555/admin
client-terminator:
echo 5 | http ${HOST}:55555/terminator

@ -0,0 +1,13 @@
#!/bin/bash
VARYING=(72 108 144)
for var in "${VARYING[@]}"; do
mkdir -p "$var"dpi
mkdir -p "$var"dpi-orig
for ((i=5; i<=15; i++)); do
shuf -n10 /usr/share/dict/american-english > "$var"dpi-orig/"$i"words.txt
pango-view --dpi="$var" --font=mono -qo "$var"dpi-orig/"$var"dpi_"$i"words.png "$var"dpi-orig/"$i"words.txt
pngtopnm "$var"dpi-orig/"$var"dpi_"$i"words.png > "$var"dpi/"$var"dpi_"$i"words.pnm
done
done

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

@ -0,0 +1,79 @@
reset
set term jpeg size 1000,500
set output "latency.jpg"
#set xlabel "Reservation Utilization %"
#set ylabel "Latency (us)"
set key left top
set xrange [-5:]
set yrange [0:]
set style histogram columnstacked
set key horizontal
set macros
# Placement of the a,b,c,d labels in the graphs
POS = "at graph 0.05,1.03 font ',10'"
# x- and ytics for each row resp. column
NOXTICS = "unset xlabel"
# XTICS = "set xlabel 'Load %'"
XTICS = "set xlabel 'All Requests/sec'"
NOYTICS = "unset ylabel"
YTICS = "set ylabel 'Latency (us)'"
# Margins for each row resp. column
TMARGIN = "set tmargin at screen 0.90; set bmargin at screen 0.55"
BMARGIN = "set tmargin at screen 0.55; set bmargin at screen 0.20"
LMARGIN = "set lmargin at screen 0.15; set rmargin at screen 0.55"
RMARGIN = "set lmargin at screen 0.55; set rmargin at screen 0.95"
# plot \
# for [t_id in tenant_ids] 'latency_'.t_id.'.dat' using 1:7 title 'Tenant '.t_id.' p99' w lp, \
# for [t_id in tenant_ids] 'latency_'.t_id.'.dat' using 1:6 title 'Tenant '.t_id.' p90' w lp, \
# for [t_id in tenant_ids] 'latency_'.t_id.'.dat' using 1:5 title 'Tenant '.t_id.' p50' w lp, \
# for [t_id in tenant_ids] 'latency_'.t_id.'.dat' using 1:4 title 'Tenant '.t_id.' mean' w lp, \
# for [t_id in tenant_ids] 'latency_'.t_id.'.dat' using 1:3 title 'Tenant '.t_id.' min' w lp
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst
# --- GRAPH a
set label 1 'p99' @POS
@NOXTICS; @YTICS
#@TMARGIN; @LMARGIN
plot for [t_id in tenant_ids] 'latency_'.t_id.'.dat' using 1:7 title t_id w lp
# --- GRAPH b
set label 1 'p90' @POS
@NOXTICS; @NOYTICS
#@TMARGIN; @RMARGIN
plot for [t_id in tenant_ids] 'latency_'.t_id.'.dat' using 1:6 notitle w lp
# --- GRAPH c
set label 1 'p50' @POS
@XTICS; @YTICS
#@BMARGIN; @LMARGIN
plot for [t_id in tenant_ids] 'latency_'.t_id.'.dat' using 1:5 notitle w lp
# --- GRAPH d
set label 1 'mean' @POS
@XTICS; @NOYTICS
#@BMARGIN; @RMARGIN
plot for [t_id in tenant_ids] 'latency_'.t_id.'.dat' using 1:4 notitle w lp
unset multiplot
### End multiplot
# plot \
# 'latency_A.dat' using 1:7 title 'A p99' lt 1 lc 1 w lp, \
# 'latency_A.dat' using 1:6 title 'A p90' lt 2 lc 1 w lp, \
# 'latency_A.dat' using 1:5 title 'A p50' lt 3 lc 1 w lp, \
# 'latency_A.dat' using 1:4 title 'A mean' lt 4 lc 1 w lp, \
# 'latency_A.dat' using 1:3 title 'A min' lt 5 lc 1 w lp,\
# 'latency_B.dat' using 1:7 title 'B p99' lt 1 lc 2 w lp, \
# 'latency_B.dat' using 1:6 title 'B p90' lt 2 lc 2 w lp, \
# 'latency_B.dat' using 1:5 title 'B p50' lt 3 lc 2 w lp, \
# 'latency_B.dat' using 1:4 title 'B mean' lt 4 lc 2 w lp, \
# 'latency_B.dat' using 1:3 title 'B min' lt 5 lc 2 w lp
# 'latency_A.dat' using 1:8 title 'A p100' linetype 0 linecolor 1 with linespoints, \
# 'latency_B.dat' using 1:8 title 'B p100' linetype 0 linecolor 2 with linespoints, \

@ -0,0 +1,74 @@
#!/bin/bash
# shellcheck disable=SC1091,SC2034,SC2155
source ../bash_libraries/multi_tenancy_base.sh || exit 1
# Configure SERVER parameters: (this is to skip the .env config file)
export SLEDGE_SCHEDULER=SJF
export SLEDGE_DISABLE_PREEMPTION=false
export SLEDGE_SPINLOOP_PAUSE_ENABLED=false
export SLEDGE_SANDBOX_PERF_LOG=perf.log
export SLEDGE_HTTP_SESSION_PERF_LOG=http_perf.log
export SLEDGE_NWORKERS=1
# export SLEDGE_PROC_MHZ=2660
# To reduce post processing time, provide local-only meaningful metrics:
# Comment it in order to use ALL the metrics!
declare -a SANDBOX_METRICS=(total running_sys running_user)
# The global configs for the scripts
declare -r ADMIN_ACCESS=false
declare -r CLIENT_TERMINATE_SERVER=false
declare -r DURATION_sec=60
declare -r ESTIMATIONS_PERCENTILE=60
declare -r NWORKERS=${SLEDGE_NWORKERS:-1}
# Tenant configs:
declare -ar TENANT_IDS=("cnn" "cifar10" "gocr" "lpd" "resize" "ekf")
declare -ar INIT_PORTS=(10000 15000 20000 25000 30000 35000)
declare -ar ROUTES=("cnn" "cifar10" "gocr" "lpd" "resize" "ekf")
declare -r NONE="0"
declare -r GET_JPEG_RESOLUTION="get_jpeg_resolution.wasm.so"
# Per route configs:
declare -ar WASM_PATHS=("$CNN" "$CIFAR10" "$GOCR" "$LPD" "$RESIZE" "$EKF")
declare -ar WASM_PATHS_PREPROCESSING=("$GET_JPEG_RESOLUTION" "$GET_JPEG_RESOLUTION" "$GET_JPEG_RESOLUTION" "$GET_JPEG_RESOLUTION" "$NONE")
declare -ar RESP_CONTENT_TYPES=("text/plain" "text/plain" "text/plain" "text/plain" "image/jpeg" "application/octet-stream")
declare -ar EXPECTED_EXEC_TIMES_us=("600000" "4000" "8900" "16700" "62000" "30")
declare -ar DEADLINE_TO_EXEC_RATIOs=("500" "500" "500" "500" "500" "5000") # percentage
# Regressions Model input:
declare -ar PREPROCESS_WASM_PATHS=("$GET_JPEG_RESOLUTION" "$NONE" "$NONE" "$GET_JPEG_RESOLUTION" "$GET_JPEG_RESOLUTION" "$NONE")
declare -ar MODEL_BIASES=("1500" "2000" "2500" "3000" "3500" "100")
declare -ar MODEL_SCALES=("1500" "2000" "2500" "3000" "3500" "100")
declare -ar MODEL_NUM_OF_PARAMS=("2" "1" "1" "2" "2" "1")
declare -ar MODEL_BETA1S=("1500" "2000" "2500" "3000" "3500" "100")
declare -ar MODEL_BETA2S=("1500" "0" "0" "3000" "3500" "0")
# This is needed if you want loadtest to time out for requests that miss their deadlines (timeout = deadline):
declare -gr LOADTEST_REQUEST_TIMEOUT=false
# For HEY -d is text, -D is file input. For LoadTest -P is text, -b is file input.
# ALso, LoadTest now supports -B for random file in the folder. HEY supports a single file.
declare -ar ARG_OPTS_HEY=("-D" "-D" "-D" "-D" "-D")
declare -ar ARG_OPTS_LT=("-B" "-B" "-B" "-B" "-B") # "-P -P -P")
declare -ar ARGS=("input-cnn" "input-cifar10" "input-gocr" "input-lpd-jpg" "input-resize" "input-ekf")
# declare -ar ARGS=("input-cnn/faces01.jpg" "input-cifar10/airplane1.bmp" "input-gocr/5x8.pnm" "input-lpd-jpg/Cars0.jpg" "input-resize/picsum_512x512_01.jpg" "input-ekf/iter00.dat")
# This is needed if you want loadtest to log the randomly chosen filenames
declare -gr LOADTEST_LOG_RANDOM=false
# 100=FULL load, 50=HALF load ...
declare -ar LOADS=(20 20 25 10 25 1)
# When trying varying values, you must set ONE value from the above params to ? (question mark)
# For example, for varying the loads, try: LOADS=("50 ?" "100")
declare -ar VARYING=(0) # no variation, single experiment
# Add the word "nuclio" to the end of the client execution command to run for Nuclio mode (stick to the same port and use keep-alive)
[[ "${!#}" = "nuclio" || "${!#}" = "Nuclio" ]] && NUCLIO_MODE_ENABLED=true
run_init
generate_spec_json
framework_init "$@"

@ -0,0 +1,128 @@
[
{
"name": "cifar10-000",
"port": 15000,
"routes": [
{
"route": "/cifar10",
"path": "cifar10.wasm.so",
"admissions-percentile": 60,
"relative-deadline-us": 20000,
"http-resp-content-type": "text/plain",
"path_preprocess": "0",
"model-bias": 2000,
"model-scale": 2000,
"model-num-of-param": 1,
"model-beta1": 2000,
"model-beta2": 0
}
],
"replenishment-period-us": 0,
"max-budget-us": 0
},
{
"name": "cnn-000",
"port": 10000,
"routes": [
{
"route": "/cnn",
"path": "cnn_face_detection.wasm.so",
"admissions-percentile": 60,
"relative-deadline-us": 3000000,
"http-resp-content-type": "text/plain",
"path_preprocess": "get_jpeg_resolution.wasm.so",
"model-bias": 1500,
"model-scale": 1500,
"model-num-of-param": 2,
"model-beta1": 1500,
"model-beta2": 1500
}
],
"replenishment-period-us": 0,
"max-budget-us": 0
},
{
"name": "ekf-000",
"port": 35000,
"routes": [
{
"route": "/ekf",
"path": "gps_ekf.wasm.so",
"admissions-percentile": 60,
"relative-deadline-us": 1500,
"http-resp-content-type": "application/octet-stream",
"path_preprocess": "0",
"model-bias": 100,
"model-scale": 100,
"model-num-of-param": 1,
"model-beta1": 100,
"model-beta2": 0
}
],
"replenishment-period-us": 0,
"max-budget-us": 0
},
{
"name": "gocr-000",
"port": 20000,
"routes": [
{
"route": "/gocr",
"path": "gocr.wasm.so",
"admissions-percentile": 60,
"relative-deadline-us": 44500,
"http-resp-content-type": "text/plain",
"path_preprocess": "0",
"model-bias": 2500,
"model-scale": 2500,
"model-num-of-param": 1,
"model-beta1": 2500,
"model-beta2": 0
}
],
"replenishment-period-us": 0,
"max-budget-us": 0
},
{
"name": "lpd-000",
"port": 25000,
"routes": [
{
"route": "/lpd",
"path": "license_plate_detection.wasm.so",
"admissions-percentile": 60,
"relative-deadline-us": 83500,
"http-resp-content-type": "text/plain",
"path_preprocess": "get_jpeg_resolution.wasm.so",
"model-bias": 3000,
"model-scale": 3000,
"model-num-of-param": 2,
"model-beta1": 3000,
"model-beta2": 3000
}
],
"replenishment-period-us": 0,
"max-budget-us": 0
},
{
"name": "resize-000",
"port": 30000,
"routes": [
{
"route": "/resize",
"path": "resize_image.wasm.so",
"admissions-percentile": 60,
"relative-deadline-us": 310000,
"http-resp-content-type": "image/jpeg",
"path_preprocess": "get_jpeg_resolution.wasm.so",
"model-bias": 3500,
"model-scale": 3500,
"model-num-of-param": 2,
"model-beta1": 3500,
"model-beta2": 3500
}
],
"replenishment-period-us": 0,
"max-budget-us": 0
}
]

@ -0,0 +1,17 @@
reset
set term jpeg
set output "success.jpg"
#set xlabel "Reservation Utilization %"
#set xlabel "Load %"
set xlabel "Requests/sec"
set ylabel "Deadline success rate %"
set xrange [-5:]
set yrange [0:110]
plot for [t_id in tenant_ids] 'success_'.t_id.'.dat' using 1:2 title t_id w lp
#plot 'success_A.dat' using 1:2 title 'Tenant A success rate' linetype 1 linecolor 1 with linespoints,\
# 'success_B.dat' using 1:2 title 'Tenant B success rate' lt 2 lc 2 w lp

@ -0,0 +1,13 @@
{
"name": "tenant",
"port": 0,
"routes": [
{
"route": "/route",
"path": "fibonacci.wasm.so",
"admissions-percentile": 60,
"relative-deadline-us": 5000,
"http-resp-content-type": "text/plain"
}
]
}

@ -0,0 +1,17 @@
reset
set term jpeg
set output "throughput.jpg"
#set xlabel "Reservation Utilization %"
#set xlabel "Load %"
set xlabel "All Requests/sec"
set ylabel "Successful Requests/sec"
set xrange [0:]
set yrange [0:]
plot for [t_id in tenant_ids] 'throughput_'.t_id.'.dat' using 1:2 title t_id w lp
#plot 'throughput_A.dat' using 1:2 title 'Tenant A Throughput' linetype 1 linecolor 1 with linespoints,\
# 'throughput_B.dat' using 1:2 title 'Tenant B Throughput' linetype 2 linecolor 2 with linespoints

@ -4,7 +4,6 @@
"port": 55555,
"replenishment-period-us": 0,
"max-budget-us": 0,
"reservation-percentile": 0,
"routes": [
{
"route": "/admin",
@ -29,7 +28,6 @@
"port": 10000,
"replenishment-period-us": 0,
"max-budget-us": 0,
"reservation-percentile": 0,
"routes": [
{
"route": "/fib1",
@ -54,7 +52,6 @@
"port": 20000,
"replenishment-period-us": 0,
"max-budget-us": 0,
"reservation-percentile": 0,
"routes": [
{
"route": "/fib",

@ -3,7 +3,6 @@
"port": 0,
"replenishment-period-us": 0,
"max-budget-us": 0,
"reservation-percentile": 0,
"routes": [
{
"route": "/route",

@ -2,8 +2,6 @@
{
"name": "gwu",
"port": 1337,
"replenishment-period-us": 0,
"max-budget-us": 0,
"routes": [
{
"route": "/set",

@ -2,9 +2,6 @@
{
"name": "gwu",
"port": 10000,
"replenishment-period-us": 0,
"max-budget-us": 0,
"reservation-percentile": 0,
"routes": [
{
"route": "/face",

@ -2,8 +2,6 @@
{
"name": "gwu",
"port": 10000,
"replenishment-period-us": 0,
"max-budget-us": 0,
"routes": [
{
"route": "/resize_small",

@ -2,8 +2,6 @@
{
"name": "gwu",
"port": 10000,
"replenishment-period-us": 0,
"max-budget-us": 0,
"routes": [
{
"route": "/resize",

@ -2,8 +2,6 @@
{
"name": "gwu",
"port": 10000,
"replenishment-period-us": 0,
"max-budget-us": 0,
"routes": [
{
"route": "/lpd1",

@ -2,8 +2,6 @@
{
"name": "gwu",
"port": 10000,
"replenishment-period-us": 0,
"max-budget-us": 0,
"routes": [
{
"route": "/hello_ps",

@ -2,8 +2,6 @@
{
"name": "gwu",
"port": 10000,
"replenishment-period-us": 0,
"max-budget-us": 0,
"routes": [
{
"route": "/stack_overflow",

@ -2,8 +2,6 @@
{
"name": "gwu",
"port": 10000,
"replenishment-period-us": 0,
"max-budget-us": 0,
"routes": [
{
"route": "/divide",

@ -2,8 +2,6 @@
{
"name": "gwu",
"port": 10000,
"replenishment-period-us": 0,
"max-budget-us": 0,
"routes": [
{
"route": "/fibonacci_10",

@ -2,8 +2,6 @@
{
"name": "gwu",
"port": 10000,
"replenishment-period-us": 0,
"max-budget-us": 0,
"routes": [
{
"route": "/cifar10_1.5",

Loading…
Cancel
Save