From 01acb468de8e7eb178fbfd50ad664de5451d8599 Mon Sep 17 00:00:00 2001 From: emil Date: Mon, 15 Jul 2024 17:28:19 +0400 Subject: [PATCH] feat: added logging instrumentation for tenant preprocessing param --- runtime/include/execution_regression.h | 4 ++-- runtime/include/sandbox_perf_log.h | 14 ++++++++------ runtime/include/sandbox_types.h | 1 + runtime/src/sandbox.c | 1 + tests/bash_libraries/experiment_globals.sh | 3 ++- tests/multi-tenancy-predictions/run.sh | 1 - 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/runtime/include/execution_regression.h b/runtime/include/execution_regression.h index deb8159..05c9d67 100644 --- a/runtime/include/execution_regression.h +++ b/runtime/include/execution_regression.h @@ -11,7 +11,7 @@ get_regression_prediction(struct http_session *session) /* Default Pre-processing - Extract payload size */ const int payload_size = session->http_request.body_length; - const double regression_params[2] = {payload_size, session->paregression_paramram2}; + const double regression_params[2] = {payload_size, session->regression_param}; /* Perform Linear Regression using the factors provided by the regressor performed AoT on Matlab using training * tenant-given dataset */ @@ -23,4 +23,4 @@ get_regression_prediction(struct http_session *session) return prediction; } -#endif \ No newline at end of file +#endif diff --git a/runtime/include/sandbox_perf_log.h b/runtime/include/sandbox_perf_log.h index 0610f2d..18389e3 100644 --- a/runtime/include/sandbox_perf_log.h +++ b/runtime/include/sandbox_perf_log.h @@ -13,9 +13,10 @@ static inline void sandbox_perf_log_print_header() { if (sandbox_perf_log == NULL) { perror("sandbox perf log"); } - fprintf(sandbox_perf_log, "id,tenant,route,state,deadline,actual,queued,uninitialized,allocated,initialized," - "runnable,interrupted,preempted," - "running_sys,running_user,asleep,returned,complete,error,proc_MHz,payload_size\n"); + fprintf(sandbox_perf_log, + "id,tenant,route,state,deadline,actual,queued,uninitialized,allocated,initialized," + "runnable,interrupted,preempted," + "running_sys,running_user,asleep,returned,complete,error,proc_MHz,payload_size,regression_param\n"); } /** @@ -37,8 +38,8 @@ sandbox_perf_log_print_entry(struct sandbox *sandbox) * seperately from current linear memory size. */ fprintf(sandbox_perf_log, - "%lu,%s,%s,%s,%lu,%lu,%lu,%lu,%lu,%lu,%lu,%lu,%lu,%lu,%lu,%lu,%lu,%lu,%lu,%u,%u,%d,%d\n", sandbox->id, - sandbox->tenant->name, sandbox->route->route, sandbox_state_stringify(sandbox->state), + "%lu,%s,%s,%s,%lu,%lu,%lu,%lu,%lu,%lu,%lu,%lu,%lu,%lu,%lu,%lu,%lu,%lu,%lu,%u,%u,%d,%d,%lf\n", + sandbox->id, sandbox->tenant->name, sandbox->route->route, sandbox_state_stringify(sandbox->state), sandbox->route->relative_deadline, sandbox->total_time, queued_duration, sandbox->duration_of_state[SANDBOX_UNINITIALIZED], sandbox->duration_of_state[SANDBOX_ALLOCATED], sandbox->duration_of_state[SANDBOX_INITIALIZED], sandbox->duration_of_state[SANDBOX_RUNNABLE], @@ -46,7 +47,8 @@ sandbox_perf_log_print_entry(struct sandbox *sandbox) sandbox->duration_of_state[SANDBOX_RUNNING_SYS], sandbox->duration_of_state[SANDBOX_RUNNING_USER], sandbox->duration_of_state[SANDBOX_ASLEEP], sandbox->duration_of_state[SANDBOX_RETURNED], sandbox->duration_of_state[SANDBOX_COMPLETE], sandbox->duration_of_state[SANDBOX_ERROR], - runtime_processor_speed_MHz, sandbox->response_code, 0, sandbox->payload_size); + runtime_processor_speed_MHz, sandbox->response_code, 0, sandbox->payload_size, + sandbox->regression_param); } static inline void diff --git a/runtime/include/sandbox_types.h b/runtime/include/sandbox_types.h index 49cfb80..4c4dd70 100644 --- a/runtime/include/sandbox_types.h +++ b/runtime/include/sandbox_types.h @@ -68,6 +68,7 @@ struct sandbox { deadline (cycles) */ uint64_t total_time; /* Total time from Request to Response */ int payload_size; + double regression_param; /* Calculated in tenant preprocessing logic if provided */ /* System Interface State */ int32_t return_value; diff --git a/runtime/src/sandbox.c b/runtime/src/sandbox.c index 6c9cbe1..17ac763 100644 --- a/runtime/src/sandbox.c +++ b/runtime/src/sandbox.c @@ -155,6 +155,7 @@ sandbox_init(struct sandbox *sandbox, struct module *module, struct http_session sandbox->absolute_deadline = sandbox->timestamp_of.allocation + sandbox->route->relative_deadline; sandbox->payload_size = session->http_request.body_length; + sandbox->regression_param = session->regression_param; /* * Admissions Control State diff --git a/tests/bash_libraries/experiment_globals.sh b/tests/bash_libraries/experiment_globals.sh index ad6e98a..485d160 100644 --- a/tests/bash_libraries/experiment_globals.sh +++ b/tests/bash_libraries/experiment_globals.sh @@ -40,7 +40,8 @@ declare -gr SANDBOX_ROUTE_FIELD=3 declare -gr SANDBOX_CPU_FREQ_FIELD=20 declare -gr SANDBOX_RESPONSE_CODE_FIELD=21 declare -gr SANDBOX_GUARANTEE_TYPE_FIELD=22 -declare -gr SANDBOX_PAYLOAD_SIZE=23 +# declare -gr SANDBOX_PAYLOAD_SIZE=23 +# declare -gr SANDBOX_REGRESSION_PARAM=24 # HTTP Session Perf Log Globals: declare -ga HTTP_METRICS=(http_receive http_sent http_total http_preprocess) diff --git a/tests/multi-tenancy-predictions/run.sh b/tests/multi-tenancy-predictions/run.sh index 323948e..7dba355 100755 --- a/tests/multi-tenancy-predictions/run.sh +++ b/tests/multi-tenancy-predictions/run.sh @@ -33,7 +33,6 @@ 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