Skip to content

Commit

Permalink
feat: added logging instrumentation for tenant preprocessing param
Browse files Browse the repository at this point in the history
  • Loading branch information
emil916 committed Jul 15, 2024
1 parent 693e633 commit 01acb46
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions runtime/include/execution_regression.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -23,4 +23,4 @@ get_regression_prediction(struct http_session *session)
return prediction;
}

#endif
#endif
14 changes: 8 additions & 6 deletions runtime/include/sandbox_perf_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

/**
Expand All @@ -37,16 +38,17 @@ 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],
sandbox->duration_of_state[SANDBOX_INTERRUPTED], sandbox->duration_of_state[SANDBOX_PREEMPTED],
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
Expand Down
1 change: 1 addition & 0 deletions runtime/include/sandbox_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions runtime/src/sandbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion tests/bash_libraries/experiment_globals.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion tests/multi-tenancy-predictions/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 01acb46

Please sign in to comment.