From 5968d9b72e562b862418ec53aa0056a51f8836ae Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 24 Mar 2021 11:17:25 -0400 Subject: [PATCH 1/3] feat: more explicit config logging and validation --- runtime/Makefile | 23 +++-- runtime/include/admissions_info.h | 3 +- runtime/src/main.c | 143 +++++++++++++++++++++++++++--- runtime/src/module.c | 57 ++++++++++-- 4 files changed, 195 insertions(+), 31 deletions(-) diff --git a/runtime/Makefile b/runtime/Makefile index f9244c4..af3bcaf 100644 --- a/runtime/Makefile +++ b/runtime/Makefile @@ -1,4 +1,10 @@ ARCH := $(shell uname -m) +ifneq ($(ARCH),x86_64) +ifneq ($(ARCH),aarch64) +$(error Unsupported Architecture. Supports x86_64 and aarch64, found $(ARCH)) +endif +endif + TOTAL_CORES := $(shell getconf _NPROCESSORS_CONF) PAGE_SIZE=$(shell getconf PAGESIZE) @@ -11,16 +17,14 @@ CC_OPTIONS = -O3 -flto -g -pthread -D_GNU_SOURCE BINARY_NAME=sledgert -# Options: {USE_MEM_GENERIC, USE_MEM_VM} -USE_MEM = USE_MEM_VM # Feature Toggles -# CFLAGS += -DADMISSIONS_CONTROL +CFLAGS += -DADMISSIONS_CONTROL # Debugging Flags # Strips out calls to assert() and disables debuglog -# CFLAGS += -DNDEBUG +CFLAGS += -DNDEBUG # Redirects debuglogs to /runtime/bin/sledge.log # CFLAGS += -DLOG_TO_FILE @@ -60,7 +64,8 @@ CFLAGS += -DPAGE_SIZE=$(PAGE_SIZE) # Optionally Disable preemption # CFLAGS += -DPREEMPT_DISABLE -CFLAGS += -D${USE_MEM} +# Sandboxes running on Sledge always use WebAssembly linear memory +CFLAGS += -DUSE_MEM_VM # Preprocessor LDFLAGS += -Wl,--export-dynamic -ldl -lm @@ -72,14 +77,8 @@ CFILES += src/*.c CFILES += src/arch/${ARCH}/*.c CFILES += src/libc/*.c CFILES += src/memory/common.c -CFILES += thirdparty/dist/lib/http_parser.o -# TODO: Is USE_MEM_GENERIC out of date? I do not see that file. -# Does that mean we can make USE_MEM_VM an invariant? -ifeq ($(USE_MEM),USE_MEM_GENERIC) -CFILES += src/memory/generic.c -else ifeq ($(USE_MEM),USE_MEM_VM) CFILES += src/memory/64bit_nix.c -endif +CFILES += thirdparty/dist/lib/http_parser.o # Configuring Jasmine JSMNCFLAGS += -DJSMN_STATIC diff --git a/runtime/include/admissions_info.h b/runtime/include/admissions_info.h index 55211e3..e239236 100644 --- a/runtime/include/admissions_info.h +++ b/runtime/include/admissions_info.h @@ -20,7 +20,8 @@ admissions_info_initialize(struct admissions_info *self, int percentile, uint64_ uint64_t relative_deadline) { #ifdef ADMISSIONS_CONTROL - + assert(relative_deadline > 0); + assert(expected_execution > 0); self->relative_deadline = relative_deadline; self->estimate = admissions_control_calculate_estimate(expected_execution, relative_deadline); debuglog("Initial Estimate: %lu\n", self->estimate); diff --git a/runtime/src/main.c b/runtime/src/main.c index 1a3290f..6390565 100644 --- a/runtime/src/main.c +++ b/runtime/src/main.c @@ -9,6 +9,12 @@ #include #include +#ifdef LOG_TO_FILE +#include +#include +#include +#endif + #include "debuglog.h" #include "module.h" #include "panic.h" @@ -81,7 +87,7 @@ runtime_allocate_available_cores() { /* Find the number of processors currently online */ runtime_total_online_processors = sysconf(_SC_NPROCESSORS_ONLN); - printf("Detected %u cores\n", runtime_total_online_processors); + printf("\tCore Count: %u\n", runtime_total_online_processors); uint32_t max_possible_workers = runtime_total_online_processors - 1; if (runtime_total_online_processors < 2) panic("Runtime requires at least two cores!"); @@ -98,8 +104,9 @@ runtime_allocate_available_cores() runtime_worker_threads_count = max_possible_workers; } - printf("Running one listener core at ID %u and %u worker core(s) starting at ID %u\n", LISTENER_THREAD_CORE_ID, - runtime_worker_threads_count, runtime_first_worker_processor); + printf("\tListener core ID: %u\n", LISTENER_THREAD_CORE_ID); + printf("\tFirst Worker core ID: %u\n", runtime_first_worker_processor); + printf("\tWorker core count: %u\n", runtime_worker_threads_count); } /** @@ -205,39 +212,155 @@ runtime_configure() } else { panic("Invalid scheduler policy: %s. Must be {EDF|FIFO}\n", scheduler_policy); } - printf("Scheduler Policy: %s\n", print_runtime_scheduler(runtime_scheduler)); + printf("\tScheduler Policy: %s\n", print_runtime_scheduler(runtime_scheduler)); /* Runtime Perf Log */ char *runtime_sandbox_perf_log_path = getenv("SLEDGE_SANDBOX_PERF_LOG"); if (runtime_sandbox_perf_log_path != NULL) { - printf("Logging Sandbox Performance to: %s\n", runtime_sandbox_perf_log_path); + printf("\tSandbox Performance Log: %s\n", runtime_sandbox_perf_log_path); runtime_sandbox_perf_log = fopen(runtime_sandbox_perf_log_path, "w"); if (runtime_sandbox_perf_log == NULL) { perror("sandbox perf log"); } fprintf(runtime_sandbox_perf_log, "id,function,state,deadline,actual,queued,initializing,runnable," "running,blocked,returned,memory\n"); + } else { + printf("\tSandbox Performance Log: Disabled\n"); } } +void +log_compiletime_config() +{ + printf("Static Compiler Flags:\n"); +#ifdef ADMISSIONS_CONTROL + printf("\tAdmissions Control: Enabled\n"); +#else + printf("\tAdmissions Control: Disabled\n"); +#endif + +#ifdef NDEBUG + printf("\tAssertions and Debug Logs: Disabled\n"); +#else + printf("\tAssertions and Debug Logs: Enabled\n"); +#endif + +#ifdef LOG_TO_FILE + printf("\tLogging to: %s\n", RUNTIME_LOG_FILE); +#else + printf("\tLogging to: STDOUT and STDERR\n"); +#endif + +#if defined(aarch64) + printf("\tArchitecture: %s\n", "aarch64"); +#elif defined(x86_64) + printf("\tArchitecture: %s\n", "x86_64"); +#endif + + // TODO: Static assertion of define + int ncores = NCORES; + printf("\tTotal Cores: %d\n", ncores); + int page_size = PAGE_SIZE; + printf("\tPage Size: %d\n", page_size); + +#ifdef LOG_HTTP_PARSER + printf("\tLog HTTP Parser: Enabled\n"); +#else + printf("\tLog HTTP Parser: Disabled\n"); +#endif + +#ifdef LOG_STATE_CHANGES + printf("\tLog State Changes: Enabled\n"); +#else + printf("\tLog State Changes: Disabled\n"); +#endif + +#ifdef LOG_LOCK_OVERHEAD + printf("\tLog Lock Overhead: Enabled\n"); +#else + printf("\tLog Lock Overhead: Disabled\n"); +#endif + +#ifdef LOG_LISTENER_LOCK_OVERHEAD + printf("\tLog Listener Lock Overhead: Enabled\n"); +#else + printf("\tLog Listener Lock Overhead: Disabled\n"); +#endif + +#ifdef LOG_CONTEXT_SWITCHES + printf("\tLog Context Switches: Enabled\n"); +#else + printf("\tLog Context Switches: Disabled\n"); +#endif + +#ifdef LOG_ADMISSIONS_CONTROL + printf("\tLog Admissions Control: Enabled\n"); +#else + printf("\tLog Admissions Control: Disabled\n"); +#endif + +#ifdef LOG_REQUEST_ALLOCATION + printf("\tLog Request Allocation: Enabled\n"); +#else + printf("\tLog Request Allocation: Disabled\n"); +#endif + +#ifdef LOG_PREEMPTION + printf("\tLog Preemption: Enabled\n"); +#else + printf("\tLog Preemption: Disabled\n"); +#endif + +#ifdef LOG_MODULE_LOADING + printf("\tLog Module Loading: Enabled\n"); +#else + printf("\tLog Module Loading: Disabled\n"); +#endif + +#ifdef LOG_TOTAL_REQS_RESPS + printf("\tLog Total Reqs/Resps: Enabled\n"); +#else + printf("\tLog Total Reqs/Resps: Disabled\n"); +#endif + +#ifdef LOG_SANDBOX_COUNT + printf("\tLog Sandbox Count: Enabled\n"); +#else + printf("\tLog Sandbox Count: Disabled\n"); +#endif + +#ifdef LOG_LOCAL_RUNQUEUE + printf("\tLog Local Runqueue: Enabled\n"); +#else + printf("\tLog Local Runqueue: Disabled\n"); +#endif +} + int main(int argc, char **argv) { - runtime_process_debug_log_behavior(); - - printf("Starting the Sledge runtime\n"); if (argc != 2) { runtime_usage(argv[0]); exit(-1); } + printf("Starting the Sledge runtime\n"); + + log_compiletime_config(); + runtime_process_debug_log_behavior(); + + printf("Runtime Environment:\n"); + memset(runtime_worker_threads, 0, sizeof(pthread_t) * WORKER_THREAD_CORE_COUNT); runtime_processor_speed_MHz = runtime_get_processor_speed_MHz(); if (unlikely(runtime_processor_speed_MHz == 0)) panic("Failed to detect processor speed\n"); - runtime_relative_deadline_us_max = UINT64_MAX / runtime_processor_speed_MHz; + runtime_relative_deadline_us_max = UINT64_MAX / runtime_processor_speed_MHz; + // TODO: Just here for troubleshooting. Delete me later + printf("Runtime Relative Deadline Max: %lu\n", runtime_relative_deadline_us_max); + printf("UINT32_MAX: %u\n", UINT32_MAX); software_interrupt_interval_duration_in_cycles = (uint64_t)SOFTWARE_INTERRUPT_INTERVAL_DURATION_IN_USEC * runtime_processor_speed_MHz; - printf("Detected processor speed of %u MHz\n", runtime_processor_speed_MHz); + printf("\tProcessor Speed: %u MHz\n", runtime_processor_speed_MHz); runtime_set_resource_limits_to_max(); runtime_allocate_available_cores(); diff --git a/runtime/src/module.c b/runtime/src/module.c index 03439ab..fc8d881 100644 --- a/runtime/src/module.c +++ b/runtime/src/module.c @@ -386,23 +386,49 @@ module_new_from_json(char *file_name) file_buffer + tokens[j + i + 1].start); sprintf(key, "%.*s", tokens[j + i].end - tokens[j + i].start, file_buffer + tokens[j + i].start); + + if (strlen(key) == 0) panic("Unexpected encountered empty key\n"); + if (strlen(val) == 0) panic("%s field contained empty string\n", key); + if (strcmp(key, "name") == 0) { + // TODO: Currently, multiple modules can have identical names. Ports are the true unique + // identifiers. Consider enforcing unique names in future strcpy(module_name, val); } else if (strcmp(key, "path") == 0) { + // Invalid path will crash on dlopen strcpy(module_path, val); } else if (strcmp(key, "port") == 0) { - port = atoi(val); + // Validate sane port + // If already taken, will error on bind call in module_listen + int buffer = atoi(val); + if (buffer < 0 || buffer > 65535) + panic("Expected port between 0 and 65535, saw %d\n", buffer); + port = buffer; } else if (strcmp(key, "argsize") == 0) { + // Validate in expected range 0..127. Unclear if 127 is an actual hard limit argument_count = atoi(val); + if (argument_count < 0 || argument_count > 127) + panic("Expected argument count between 0 and 127, saw %d\n", argument_count); } else if (strcmp(key, "active") == 0) { - is_active = (strcmp(val, "yes") == 0); + if (strcmp(val, "yes") == 0) { + is_active = true; + } else if (strcmp(val, "no") == 0) { + is_active = false; + } else { + panic("Expected active key to have value of yes or no, was %s\n", val); + } } else if (strcmp(key, "relative-deadline-us") == 0) { - unsigned long long buffer = strtoull(val, NULL, 10); - if (buffer > runtime_relative_deadline_us_max) - panic("Max relative-deadline-us is %u, but entry was %llu\n", UINT32_MAX, - buffer); + // Panic on overflow + // TODO: Consider underflow + int64_t buffer = strtoll(val, NULL, 10); + if (buffer < 0 || buffer > (int64_t)runtime_relative_deadline_us_max) + panic("Relative-deadline-us must be between 0 and %lu, was %ld\n", + runtime_relative_deadline_us_max, buffer); relative_deadline_us = (uint32_t)buffer; } else if (strcmp(key, "expected-execution-us") == 0) { + // Panic on overflow + // TODO: Consider underflow + debuglog("expected-execution-us: %s\n", val); unsigned long long buffer = strtoull(val, NULL, 10); if (buffer > UINT32_MAX) panic("Max expected-execution-us is %u, but entry was %llu\n", UINT32_MAX, @@ -458,11 +484,26 @@ module_new_from_json(char *file_name) } i += ntoks; -/* Validate presence of required fields */ + /* Validate presence of required fields */ + + if (strlen(module_name) == 0) panic("name field is required\n"); + if (strlen(module_path) == 0) panic("path field is required\n"); + if (port == 0) panic("port field is required\n"); + #ifdef ADMISSIONS_CONTROL - if (expected_execution_us == 0) panic("expected-execution-us is required for EDF\n"); + /* expected-execution-us and relative-deadline-us are required in case of admissions control */ + if (expected_execution_us == 0) panic("expected-execution-us is required\n"); + if (relative_deadline_us == 0) panic("relative_deadline_us is required\n"); +#else + /* relative-deadline-us is required if scheduler is EDF */ + if (runtime_scheduler == RUNTIME_SCHEDULER_EDF && relative_deadline_us == 0) + panic("relative_deadline_us is required\n"); #endif + /* argsize defaults to 0 if absent */ + /* http-req-headers defaults to empty if absent */ + /* http-req-headers defaults to empty if absent */ + if (is_active) { /* Allocate a module based on the values from the JSON */ struct module *module = module_new(module_name, module_path, argument_count, 0, 0, From 86b1a274e934ef8683141a072cbec935696f9015 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 24 Mar 2021 19:53:13 -0400 Subject: [PATCH 2/3] chore: validation and active as boolean --- README.md | 4 +- .../applications/ekf/by_iteration/spec.json | 6 +- .../applications/ekf/one_iteration/spec.json | 2 +- .../imageclassification/spec.json | 12 +- .../imageresize/by_resolution/spec.json | 10 +- .../applications/imageresize/test/spec.json | 2 +- .../licenseplate/by_plate_count/spec.json | 6 +- .../applications/ocr/by_dpi/spec.json | 6 +- .../applications/ocr/by_font/spec.json | 10 +- .../applications/ocr/by_word/spec.json | 10 +- .../applications/ocr/fivebyeight/spec.json | 2 +- .../applications/ocr/handwriting/spec.json | 2 +- .../applications/ocr/hyde/spec.json | 2 +- runtime/experiments/applications/spec.json | 7 +- .../applications/speechtotext/spec.json | 2 +- runtime/experiments/concurrency/spec.json | 26 +- runtime/experiments/deadline/spec.json | 4 +- runtime/experiments/payload/spec.json | 104 +++--- runtime/experiments/preemption/spec.json | 4 +- runtime/include/admissions_control.h | 2 +- runtime/include/runtime.h | 20 +- runtime/src/main.c | 14 +- runtime/src/module.c | 50 +-- runtime/tests/preemption/test_fibonacci.json | 26 +- .../preemption/test_fibonacci_multiple.json | 4 +- runtime/tests/test_armcifar10.json | 26 +- runtime/tests/test_empty.json | 26 +- runtime/tests/test_fibonacci.json | 2 +- runtime/tests/test_gocr.json | 26 +- runtime/tests/test_modules.json | 320 +++++++++--------- runtime/tests/test_sodlpd.json | 26 +- runtime/tests/test_sodresize.json | 26 +- runtime/tests/test_work.json | 26 +- runtime/tests/test_work100k.json | 26 +- runtime/tests/test_work10k.json | 26 +- runtime/tests/test_work1k.json | 26 +- runtime/tests/test_work1m.json | 26 +- 37 files changed, 465 insertions(+), 454 deletions(-) diff --git a/README.md b/README.md index f947596..6bccaf2 100644 --- a/README.md +++ b/README.md @@ -60,10 +60,12 @@ An SLEdge serverless function consists of a shared library (\*.so) and a JSON co ```json { - "active": "yes", + "active": true, "name": "fibonacci", "path": "fibonacci_wasm.so", "port": 10000, + "expected-execution-us": 600, + "relative-deadline-us": 2000, "argsize": 1, "http-req-headers": [], "http-req-content-type": "text/plain", diff --git a/runtime/experiments/applications/ekf/by_iteration/spec.json b/runtime/experiments/applications/ekf/by_iteration/spec.json index 2043944..0d45e40 100644 --- a/runtime/experiments/applications/ekf/by_iteration/spec.json +++ b/runtime/experiments/applications/ekf/by_iteration/spec.json @@ -1,5 +1,5 @@ { - "active": "yes", + "active": true, "name": "ekf_first_iter", "path": "ekf_wasm.so", "port": 10000, @@ -13,7 +13,7 @@ "http-resp-content-type": "application/octet-stream" }, { - "active": "yes", + "active": true, "name": "ekf_second_iter", "path": "ekf_wasm.so", "port": 10001, @@ -27,7 +27,7 @@ "http-resp-content-type": "application/octet-stream" }, { - "active": "yes", + "active": true, "name": "ekf_third_iter", "path": "ekf_wasm.so", "port": 10002, diff --git a/runtime/experiments/applications/ekf/one_iteration/spec.json b/runtime/experiments/applications/ekf/one_iteration/spec.json index de317c7..a98c2d3 100644 --- a/runtime/experiments/applications/ekf/one_iteration/spec.json +++ b/runtime/experiments/applications/ekf/one_iteration/spec.json @@ -1,5 +1,5 @@ { - "active": "yes", + "active": true, "name": "resize", "path": "ekf_wasm.so", "port": 10000, diff --git a/runtime/experiments/applications/imageclassification/spec.json b/runtime/experiments/applications/imageclassification/spec.json index 3c1c6ce..32ef760 100644 --- a/runtime/experiments/applications/imageclassification/spec.json +++ b/runtime/experiments/applications/imageclassification/spec.json @@ -1,14 +1,14 @@ { - "active": "yes", - "name": "cifar10", - "path": "cifar10_wasm.so", + "active": true, + "name": "cifar10", + "path": "cifar10_wasm.so", "port": 10000, "relative-deadline-us": 50000, "argsize": 1, "http-req-headers": [], - "http-req-content-type": "image/png", + "http-req-content-type": "image/png", "http-req-size": 4096, "http-resp-headers": [], - "http-resp-size": 128, - "http-resp-content-type": "text/plain" + "http-resp-size": 128, + "http-resp-content-type": "text/plain" } diff --git a/runtime/experiments/applications/imageresize/by_resolution/spec.json b/runtime/experiments/applications/imageresize/by_resolution/spec.json index eb8c9bc..3da8650 100644 --- a/runtime/experiments/applications/imageresize/by_resolution/spec.json +++ b/runtime/experiments/applications/imageresize/by_resolution/spec.json @@ -1,5 +1,5 @@ { - "active": "yes", + "active": true, "name": "resize_small", "path": "resize_wasm.so", "port": 10000, @@ -11,9 +11,9 @@ "http-resp-headers": [], "http-resp-size": 1024000, "http-resp-content-type": "image/png" -} +}, { - "active": "yes", + "active": true, "name": "resize_medium", "path": "resize_wasm.so", "port": 10001, @@ -25,9 +25,9 @@ "http-resp-headers": [], "http-resp-size": 1024000, "http-resp-content-type": "image/png" -} +}, { - "active": "yes", + "active": true, "name": "resize_large", "path": "resize_wasm.so", "port": 10002, diff --git a/runtime/experiments/applications/imageresize/test/spec.json b/runtime/experiments/applications/imageresize/test/spec.json index 29d0904..7ec404a 100644 --- a/runtime/experiments/applications/imageresize/test/spec.json +++ b/runtime/experiments/applications/imageresize/test/spec.json @@ -1,5 +1,5 @@ { - "active": "yes", + "active": true, "name": "resize", "path": "resize_wasm.so", "port": 10000, diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/spec.json b/runtime/experiments/applications/licenseplate/by_plate_count/spec.json index 4e823d4..4860426 100644 --- a/runtime/experiments/applications/licenseplate/by_plate_count/spec.json +++ b/runtime/experiments/applications/licenseplate/by_plate_count/spec.json @@ -1,5 +1,5 @@ { - "active": "yes", + "active": true, "name": "lpd1", "path": "lpd_wasm.so", "port": 10000, @@ -13,7 +13,7 @@ "http-resp-content-type": "text/plain" }, { - "active": "yes", + "active": true, "name": "lpd2", "path": "lpd_wasm.so", "port": 10001, @@ -27,7 +27,7 @@ "http-resp-content-type": "text/plain" }, { - "active": "yes", + "active": true, "name": "lpd4", "path": "lpd_wasm.so", "port": 10002, diff --git a/runtime/experiments/applications/ocr/by_dpi/spec.json b/runtime/experiments/applications/ocr/by_dpi/spec.json index 030eaec..6811c40 100644 --- a/runtime/experiments/applications/ocr/by_dpi/spec.json +++ b/runtime/experiments/applications/ocr/by_dpi/spec.json @@ -1,5 +1,5 @@ { - "active": "yes", + "active": true, "name": "gocr_72_dpi", "path": "gocr_wasm.so", "port": 10000, @@ -13,7 +13,7 @@ "http-resp-content-type": "text/plain" }, { - "active": "yes", + "active": true, "name": "gocr_108_dpi", "path": "gocr_wasm.so", "port": 10001, @@ -27,7 +27,7 @@ "http-resp-content-type": "text/plain" }, { - "active": "yes", + "active": true, "name": "gocr_144_dpi", "path": "gocr_wasm.so", "port": 10002, diff --git a/runtime/experiments/applications/ocr/by_font/spec.json b/runtime/experiments/applications/ocr/by_font/spec.json index 702624b..ebfd967 100644 --- a/runtime/experiments/applications/ocr/by_font/spec.json +++ b/runtime/experiments/applications/ocr/by_font/spec.json @@ -1,5 +1,5 @@ -{ - "active": "yes", +({ + "active": true, "name": "gocr_mono", "path": "gocr_wasm.so", "port": 10000, @@ -13,7 +13,7 @@ "http-resp-content-type": "text/plain" }, { - "active": "yes", + "active": true, "name": "gocr_urw_gothic", "path": "gocr_wasm.so", "port": 10001, @@ -27,7 +27,7 @@ "http-resp-content-type": "text/plain" }, { - "active": "yes", + "active": true, "name": "gocr_lobster_2", "path": "gocr_wasm.so", "port": 10002, @@ -39,4 +39,4 @@ "http-resp-headers": [], "http-resp-size": 5335057, "http-resp-content-type": "text/plain" -} +}) diff --git a/runtime/experiments/applications/ocr/by_word/spec.json b/runtime/experiments/applications/ocr/by_word/spec.json index f820aaf..8cf921b 100644 --- a/runtime/experiments/applications/ocr/by_word/spec.json +++ b/runtime/experiments/applications/ocr/by_word/spec.json @@ -1,5 +1,5 @@ -{ - "active": "yes", +({ + "active": true, "name": "gocr_1_word", "path": "gocr_wasm.so", "port": 10000, @@ -13,7 +13,7 @@ "http-resp-content-type": "text/plain" }, { - "active": "yes", + "active": true, "name": "gocr_10_words", "path": "gocr_wasm.so", "port": 10001, @@ -27,7 +27,7 @@ "http-resp-content-type": "text/plain" }, { - "active": "yes", + "active": true, "name": "gocr_100_words", "path": "gocr_wasm.so", "port": 10002, @@ -39,4 +39,4 @@ "http-resp-headers": [], "http-resp-size": 5335057, "http-resp-content-type": "text/plain" -} +}) diff --git a/runtime/experiments/applications/ocr/fivebyeight/spec.json b/runtime/experiments/applications/ocr/fivebyeight/spec.json index 85e5d4b..bc2005c 100644 --- a/runtime/experiments/applications/ocr/fivebyeight/spec.json +++ b/runtime/experiments/applications/ocr/fivebyeight/spec.json @@ -1,5 +1,5 @@ { - "active": "yes", + "active": true, "name": "gocr", "path": "gocr_wasm.so", "port": 10000, diff --git a/runtime/experiments/applications/ocr/handwriting/spec.json b/runtime/experiments/applications/ocr/handwriting/spec.json index 8e06a18..f2ab4f6 100644 --- a/runtime/experiments/applications/ocr/handwriting/spec.json +++ b/runtime/experiments/applications/ocr/handwriting/spec.json @@ -1,5 +1,5 @@ { - "active": "yes", + "active": true, "name": "gocr", "path": "gocr_wasm.so", "port": 10000, diff --git a/runtime/experiments/applications/ocr/hyde/spec.json b/runtime/experiments/applications/ocr/hyde/spec.json index 818179e..4c90d23 100644 --- a/runtime/experiments/applications/ocr/hyde/spec.json +++ b/runtime/experiments/applications/ocr/hyde/spec.json @@ -1,5 +1,5 @@ { - "active": "yes", + "active": true, "name": "gocr", "path": "gocr_wasm.so", "port": 10000, diff --git a/runtime/experiments/applications/spec.json b/runtime/experiments/applications/spec.json index 061491a..8867897 100644 --- a/runtime/experiments/applications/spec.json +++ b/runtime/experiments/applications/spec.json @@ -1,5 +1,5 @@ { - "active": "yes", + "active": true, "name": "gocr", "path": "gocr.aso", "port": 10000, @@ -13,7 +13,7 @@ "http-resp-content-type": "text/plain" }, { - "active": "yes", + "active": true, "name": "gocr", "path": "gocr.aso", "port": 10001, @@ -27,7 +27,7 @@ "http-resp-content-type": "text/plain" }, { - "active": "yes", + "active": true, "name": "gocr", "path": "gocr.aso", "port": 10002, @@ -40,4 +40,3 @@ "http-resp-size": 5335057, "http-resp-content-type": "text/plain" } - diff --git a/runtime/experiments/applications/speechtotext/spec.json b/runtime/experiments/applications/speechtotext/spec.json index 30b122d..e20c94f 100644 --- a/runtime/experiments/applications/speechtotext/spec.json +++ b/runtime/experiments/applications/speechtotext/spec.json @@ -1,5 +1,5 @@ { - "active": "yes", + "active": true, "name": "hello_ps", "path": "hello_ps_wasm.so", "port": 10000, diff --git a/runtime/experiments/concurrency/spec.json b/runtime/experiments/concurrency/spec.json index b2b4a20..6128ca1 100644 --- a/runtime/experiments/concurrency/spec.json +++ b/runtime/experiments/concurrency/spec.json @@ -1,14 +1,14 @@ { - "active": "yes", - "name": "empty", - "path": "empty_wasm.so", - "port": 10000, - "relative-deadline-us": 50000, - "argsize": 1, - "http-req-headers": [], - "http-req-content-type": "text/plain", - "http-req-size": 1024, - "http-resp-headers": [], - "http-resp-size": 1024, - "http-resp-content-type": "text/plain" -} \ No newline at end of file + "active": true, + "name": "empty", + "path": "empty_wasm.so", + "port": 10000, + "relative-deadline-us": 50000, + "argsize": 1, + "http-req-headers": [], + "http-req-content-type": "text/plain", + "http-req-size": 1024, + "http-resp-headers": [], + "http-resp-size": 1024, + "http-resp-content-type": "text/plain" +} diff --git a/runtime/experiments/deadline/spec.json b/runtime/experiments/deadline/spec.json index c1c36e2..f40b367 100644 --- a/runtime/experiments/deadline/spec.json +++ b/runtime/experiments/deadline/spec.json @@ -1,5 +1,5 @@ { - "active": "yes", + "active": true, "name": "fibonacci_10", "path": "fibonacci_wasm.so", "port": 10010, @@ -15,7 +15,7 @@ "http-resp-content-type": "text/plain" }, { - "active": "yes", + "active": true, "name": "fibonacci_40", "path": "fibonacci_wasm.so", "port": 10040, diff --git a/runtime/experiments/payload/spec.json b/runtime/experiments/payload/spec.json index fd1ff1c..6262561 100644 --- a/runtime/experiments/payload/spec.json +++ b/runtime/experiments/payload/spec.json @@ -1,60 +1,60 @@ { - "active": "yes", - "name": "work1k", - "path": "work1k_wasm.so", - "port": 10000, - "expected-execution-us": 400, - "relative-deadline-us": 2000, - "argsize": 1, - "http-req-headers": [], - "http-req-content-type": "text/plain", - "http-req-size": 1548, - "http-resp-headers": [], - "http-resp-size": 1548, - "http-resp-content-type": "text/plain" + "active": true, + "name": "work1k", + "path": "work1k_wasm.so", + "port": 10000, + "expected-execution-us": 400, + "relative-deadline-us": 2000, + "argsize": 1, + "http-req-headers": [], + "http-req-content-type": "text/plain", + "http-req-size": 1548, + "http-resp-headers": [], + "http-resp-size": 1548, + "http-resp-content-type": "text/plain" }, { - "active": "yes", - "name": "work10k", - "path": "work10k_wasm.so", - "port": 10001, - "expected-execution-us": 600, - "relative-deadline-us": 2000, - "argsize": 1, - "http-req-headers": [], - "http-req-content-type": "text/plain", - "http-req-size": 10480, - "http-resp-headers": [], - "http-resp-size": 10480, - "http-resp-content-type": "text/plain" + "active": true, + "name": "work10k", + "path": "work10k_wasm.so", + "port": 10001, + "expected-execution-us": 600, + "relative-deadline-us": 2000, + "argsize": 1, + "http-req-headers": [], + "http-req-content-type": "text/plain", + "http-req-size": 10480, + "http-resp-headers": [], + "http-resp-size": 10480, + "http-resp-content-type": "text/plain" }, { - "active": "yes", - "name": "work100k", - "path": "work100k_wasm.so", - "port": 10002, - "expected-execution-us": 700, - "relative-deadline-us": 2000, - "argsize": 1, - "http-req-headers": [], - "http-req-content-type": "text/plain", - "http-req-size": 104800, - "http-resp-headers": [], - "http-resp-size": 104800, - "http-resp-content-type": "text/plain" + "active": true, + "name": "work100k", + "path": "work100k_wasm.so", + "port": 10002, + "expected-execution-us": 700, + "relative-deadline-us": 2000, + "argsize": 1, + "http-req-headers": [], + "http-req-content-type": "text/plain", + "http-req-size": 104800, + "http-resp-headers": [], + "http-resp-size": 104800, + "http-resp-content-type": "text/plain" }, { - "active": "yes", - "name": "work1m", - "path": "work1m_wasm.so", - "port": 10003, - "expected-execution-us": 2000, - "relative-deadline-us": 6000, - "argsize": 1, - "http-req-headers": [], - "http-req-content-type": "text/plain", - "http-req-size": 1048776, - "http-resp-headers": [], - "http-resp-size": 1048776, - "http-resp-content-type": "text/plain" + "active": true, + "name": "work1m", + "path": "work1m_wasm.so", + "port": 10003, + "expected-execution-us": 2000, + "relative-deadline-us": 6000, + "argsize": 1, + "http-req-headers": [], + "http-req-content-type": "text/plain", + "http-req-size": 1048776, + "http-resp-headers": [], + "http-resp-size": 1048776, + "http-resp-content-type": "text/plain" } diff --git a/runtime/experiments/preemption/spec.json b/runtime/experiments/preemption/spec.json index f10f229..0bf91bf 100644 --- a/runtime/experiments/preemption/spec.json +++ b/runtime/experiments/preemption/spec.json @@ -1,5 +1,5 @@ { - "active": "yes", + "active": true, "name": "fibonacci_10", "path": "fibonacci_wasm.so", "port": 10010, @@ -14,7 +14,7 @@ "http-resp-content-type": "text/plain" }, { - "active": "yes", + "active": true, "name": "fibonacci_40", "path": "fibonacci_wasm.so", "port": 10040, diff --git a/runtime/include/admissions_control.h b/runtime/include/admissions_control.h index d88c258..de83adf 100644 --- a/runtime/include/admissions_control.h +++ b/runtime/include/admissions_control.h @@ -73,7 +73,7 @@ admissions_control_calculate_estimate(uint64_t estimated_execution, uint64_t rel uint64_t admissions_estimate = (estimated_execution * (uint64_t)ADMISSIONS_CONTROL_GRANULARITY) / relative_deadline; if (admissions_estimate == 0) - panic("Ration of Deadline to Execution time cannot exceed %d\n", ADMISSIONS_CONTROL_GRANULARITY); + panic("Ratio of Deadline to Execution time cannot exceed %d\n", ADMISSIONS_CONTROL_GRANULARITY); return admissions_estimate; #else diff --git a/runtime/include/runtime.h b/runtime/include/runtime.h index d6b6c47..b0266fa 100644 --- a/runtime/include/runtime.h +++ b/runtime/include/runtime.h @@ -8,13 +8,26 @@ #include "likely.h" #include "types.h" -#define LISTENER_THREAD_CORE_ID 0 /* Dedicated Listener Core */ +/* Dedicated Listener Core */ +#define LISTENER_THREAD_CORE_ID 0 #define LISTENER_THREAD_MAX_EPOLL_EVENTS 128 -#define RUNTIME_LOG_FILE "sledge.log" -#define RUNTIME_MAX_SANDBOX_REQUEST_COUNT (1 << 19) /* random! */ +#define RUNTIME_LOG_FILE "sledge.log" +/* random! */ +#define RUNTIME_MAX_SANDBOX_REQUEST_COUNT (1 << 19) #define RUNTIME_READ_WRITE_VECTOR_LENGTH 16 +/* One Hour. Fits in a uint32_t or an int64_t */ +#define RUNTIME_RELATIVE_DEADLINE_US_MAX 3600000000 + +/* One Hour. Fits in a uint32_t or an int64_t */ +#define RUNTIME_EXPECTED_EXECUTION_US_MAX 3600000000 + +/* 100 MB */ +#define RUNTIME_HTTP_REQUEST_SIZE_MAX 100000000 +/* 100 MB */ +#define RUNTIME_HTTP_RESPONSE_SIZE_MAX 100000000 + /* * Descriptor of the epoll instance used to monitor the socket descriptors of registered * serverless modules. The listener cores listens for incoming client requests through this. @@ -29,7 +42,6 @@ extern FILE *runtime_sandbox_perf_log; * See runtime_get_processor_speed_MHz for further details */ extern uint32_t runtime_processor_speed_MHz; -extern uint64_t runtime_relative_deadline_us_max; /* Count of worker threads and array of their pthread identifiers */ extern pthread_t runtime_worker_threads[]; diff --git a/runtime/src/main.c b/runtime/src/main.c index 6390565..34d9500 100644 --- a/runtime/src/main.c +++ b/runtime/src/main.c @@ -26,11 +26,10 @@ /* Conditionally used by debuglog when NDEBUG is not set */ int32_t debuglog_file_descriptor = -1; -uint32_t runtime_processor_speed_MHz = 0; -uint64_t runtime_relative_deadline_us_max = 0; /* a value higher than this will cause overflow on a uint64_t */ -uint32_t runtime_total_online_processors = 0; -uint32_t runtime_worker_threads_count = 0; -const uint32_t runtime_first_worker_processor = 1; +uint32_t runtime_processor_speed_MHz = 0; +uint32_t runtime_total_online_processors = 0; +uint32_t runtime_worker_threads_count = 0; +const uint32_t runtime_first_worker_processor = 1; /* TODO: the worker never actually records state here */ int runtime_worker_threads_argument[WORKER_THREAD_CORE_COUNT] = { 0 }; /* The worker sets its argument to -1 on error */ pthread_t runtime_worker_threads[WORKER_THREAD_CORE_COUNT]; @@ -255,7 +254,6 @@ log_compiletime_config() printf("\tArchitecture: %s\n", "x86_64"); #endif - // TODO: Static assertion of define int ncores = NCORES; printf("\tTotal Cores: %d\n", ncores); int page_size = PAGE_SIZE; @@ -354,10 +352,6 @@ main(int argc, char **argv) runtime_processor_speed_MHz = runtime_get_processor_speed_MHz(); if (unlikely(runtime_processor_speed_MHz == 0)) panic("Failed to detect processor speed\n"); - runtime_relative_deadline_us_max = UINT64_MAX / runtime_processor_speed_MHz; - // TODO: Just here for troubleshooting. Delete me later - printf("Runtime Relative Deadline Max: %lu\n", runtime_relative_deadline_us_max); - printf("UINT32_MAX: %u\n", UINT32_MAX); software_interrupt_interval_duration_in_cycles = (uint64_t)SOFTWARE_INTERRUPT_INTERVAL_DURATION_IN_USEC * runtime_processor_speed_MHz; printf("\tProcessor Speed: %u MHz\n", runtime_processor_speed_MHz); diff --git a/runtime/src/module.c b/runtime/src/module.c index fc8d881..893bf73 100644 --- a/runtime/src/module.c +++ b/runtime/src/module.c @@ -199,7 +199,7 @@ module_new(char *name, char *path, int32_t argument_count, uint32_t stack_size, module->relative_deadline_us = relative_deadline_us; /* This should have been handled when a module was loaded */ - assert(relative_deadline_us < runtime_relative_deadline_us_max); + assert(relative_deadline_us < RUNTIME_RELATIVE_DEADLINE_US_MAX); /* This can overflow a uint32_t, so be sure to cast appropriately */ module->relative_deadline = (uint64_t)relative_deadline_us * runtime_processor_speed_MHz; @@ -410,36 +410,30 @@ module_new_from_json(char *file_name) if (argument_count < 0 || argument_count > 127) panic("Expected argument count between 0 and 127, saw %d\n", argument_count); } else if (strcmp(key, "active") == 0) { - if (strcmp(val, "yes") == 0) { + assert(tokens[i + j + 1].type == JSMN_PRIMITIVE); + if (val[0] == 't') { is_active = true; - } else if (strcmp(val, "no") == 0) { + } else if (val[0] == 'f') { is_active = false; } else { - panic("Expected active key to have value of yes or no, was %s\n", val); + panic("Expected active key to be a JSON boolean, was %s\n", val); } } else if (strcmp(key, "relative-deadline-us") == 0) { - // Panic on overflow - // TODO: Consider underflow int64_t buffer = strtoll(val, NULL, 10); - if (buffer < 0 || buffer > (int64_t)runtime_relative_deadline_us_max) - panic("Relative-deadline-us must be between 0 and %lu, was %ld\n", - runtime_relative_deadline_us_max, buffer); + if (buffer < 0 || buffer > (int64_t)RUNTIME_RELATIVE_DEADLINE_US_MAX) + panic("Relative-deadline-us must be between 0 and %ld, was %ld\n", + (int64_t)RUNTIME_RELATIVE_DEADLINE_US_MAX, buffer); relative_deadline_us = (uint32_t)buffer; } else if (strcmp(key, "expected-execution-us") == 0) { - // Panic on overflow - // TODO: Consider underflow - debuglog("expected-execution-us: %s\n", val); - unsigned long long buffer = strtoull(val, NULL, 10); - if (buffer > UINT32_MAX) - panic("Max expected-execution-us is %u, but entry was %llu\n", UINT32_MAX, - buffer); - + int64_t buffer = strtoll(val, NULL, 10); + if (buffer < 0 || buffer > (int64_t)RUNTIME_EXPECTED_EXECUTION_US_MAX) + panic("Relative-deadline-us must be between 0 and %ld, was %ld\n", + (int64_t)RUNTIME_EXPECTED_EXECUTION_US_MAX, buffer); expected_execution_us = (uint32_t)buffer; } else if (strcmp(key, "admissions-percentile") == 0) { - unsigned long long buffer = strtoull(val, NULL, 10); + int32_t buffer = strtol(val, NULL, 10); if (buffer > 99 || buffer < 50) - panic("admissions-percentile must be > 50 and <= 99 but was %llu\n", buffer); - + panic("admissions-percentile must be > 50 and <= 99 but was %d\n", buffer); admissions_percentile = (int)buffer; } else if (strcmp(key, "http-req-headers") == 0) { assert(tokens[i + j + 1].type == JSMN_ARRAY); @@ -468,12 +462,22 @@ module_new_from_json(char *file_name) strncpy(r, file_buffer + g->start, g->end - g->start); } } else if (strcmp(key, "http-req-size") == 0) { - request_size = atoi(val); + int64_t buffer = strtoll(val, NULL, 10); + if (buffer < 0 || buffer > RUNTIME_HTTP_REQUEST_SIZE_MAX) + panic("http-req-size must be between 0 and %ld, was %ld\n", + (int64_t)RUNTIME_HTTP_REQUEST_SIZE_MAX, buffer); + request_size = (int32_t)buffer; } else if (strcmp(key, "http-resp-size") == 0) { - response_size = atoi(val); + int64_t buffer = strtoll(val, NULL, 10); + if (buffer < 0 || buffer > RUNTIME_HTTP_REQUEST_SIZE_MAX) + panic("http-resp-size must be between 0 and %ld, was %ld\n", + (int64_t)RUNTIME_HTTP_REQUEST_SIZE_MAX, buffer); + response_size = (int32_t)buffer; } else if (strcmp(key, "http-req-content-type") == 0) { + if (strlen(val) == 0) panic("http-req-content-type was unexpectedly an empty string"); strcpy(request_content_type, val); } else if (strcmp(key, "http-resp-content-type") == 0) { + if (strlen(val) == 0) panic("http-resp-content-type was unexpectedly an empty string"); strcpy(response_content_type, val); } else { #ifdef LOG_MODULE_LOADING @@ -521,7 +525,7 @@ module_new_from_json(char *file_name) free(reponse_headers); } - if (module_count == 0) fprintf(stderr, "%s contained no active modules\n", file_name); + if (module_count == 0) panic("%s contained no active modules\n", file_name); #ifdef LOG_MODULE_LOADING debuglog("Loaded %d module%s!\n", module_count, module_count > 1 ? "s" : ""); #endif diff --git a/runtime/tests/preemption/test_fibonacci.json b/runtime/tests/preemption/test_fibonacci.json index cbf4826..3dfa482 100644 --- a/runtime/tests/preemption/test_fibonacci.json +++ b/runtime/tests/preemption/test_fibonacci.json @@ -1,14 +1,14 @@ { - "active": "yes", - "name": "fibonacci", - "path": "fibonacci_wasm.so", - "port": 10000, - "relative-deadline-us": 50000, - "argsize": 1, - "http-req-headers": [], - "http-req-content-type": "text/plain", - "http-req-size": 1024, - "http-resp-headers": [], - "http-resp-size": 1024, - "http-resp-content-type": "text/plain" -} \ No newline at end of file + "active": true, + "name": "fibonacci", + "path": "fibonacci_wasm.so", + "port": 10000, + "relative-deadline-us": 50000, + "argsize": 1, + "http-req-headers": [], + "http-req-content-type": "text/plain", + "http-req-size": 1024, + "http-resp-headers": [], + "http-resp-size": 1024, + "http-resp-content-type": "text/plain" +} diff --git a/runtime/tests/preemption/test_fibonacci_multiple.json b/runtime/tests/preemption/test_fibonacci_multiple.json index 4a11ba3..c1b02c3 100644 --- a/runtime/tests/preemption/test_fibonacci_multiple.json +++ b/runtime/tests/preemption/test_fibonacci_multiple.json @@ -1,5 +1,5 @@ { - "active": "yes", + "active": true, "name": "fibonacci", "path": "fibonacci_wasm.so", "port": 10000, @@ -13,7 +13,7 @@ "http-resp-content-type": "text/plain" }, { - "active": "yes", + "active": true, "name": "fibonacci2", "path": "fibonacci_wasm.so", "port": 10001, diff --git a/runtime/tests/test_armcifar10.json b/runtime/tests/test_armcifar10.json index 240e584..32ef760 100644 --- a/runtime/tests/test_armcifar10.json +++ b/runtime/tests/test_armcifar10.json @@ -1,14 +1,14 @@ { - "active": "yes", - "name": "cifar10", - "path": "cifar10_wasm.so", - "port": 10000, - "relative-deadline-us": 50000, - "argsize": 1, - "http-req-headers": [], - "http-req-content-type": "image/png", - "http-req-size": 4096, - "http-resp-headers": [], - "http-resp-size": 128, - "http-resp-content-type": "text/plain" -} \ No newline at end of file + "active": true, + "name": "cifar10", + "path": "cifar10_wasm.so", + "port": 10000, + "relative-deadline-us": 50000, + "argsize": 1, + "http-req-headers": [], + "http-req-content-type": "image/png", + "http-req-size": 4096, + "http-resp-headers": [], + "http-resp-size": 128, + "http-resp-content-type": "text/plain" +} diff --git a/runtime/tests/test_empty.json b/runtime/tests/test_empty.json index b2b4a20..6128ca1 100644 --- a/runtime/tests/test_empty.json +++ b/runtime/tests/test_empty.json @@ -1,14 +1,14 @@ { - "active": "yes", - "name": "empty", - "path": "empty_wasm.so", - "port": 10000, - "relative-deadline-us": 50000, - "argsize": 1, - "http-req-headers": [], - "http-req-content-type": "text/plain", - "http-req-size": 1024, - "http-resp-headers": [], - "http-resp-size": 1024, - "http-resp-content-type": "text/plain" -} \ No newline at end of file + "active": true, + "name": "empty", + "path": "empty_wasm.so", + "port": 10000, + "relative-deadline-us": 50000, + "argsize": 1, + "http-req-headers": [], + "http-req-content-type": "text/plain", + "http-req-size": 1024, + "http-resp-headers": [], + "http-resp-size": 1024, + "http-resp-content-type": "text/plain" +} diff --git a/runtime/tests/test_fibonacci.json b/runtime/tests/test_fibonacci.json index 85a4555..146ea9c 100644 --- a/runtime/tests/test_fibonacci.json +++ b/runtime/tests/test_fibonacci.json @@ -1,5 +1,5 @@ { - "active": "yes", + "active": true, "name": "fibonacci", "path": "fibonacci_wasm.so", "port": 10000, diff --git a/runtime/tests/test_gocr.json b/runtime/tests/test_gocr.json index 5dfc241..a9632d5 100644 --- a/runtime/tests/test_gocr.json +++ b/runtime/tests/test_gocr.json @@ -1,14 +1,14 @@ { - "active": "yes", - "name": "gocr", - "path": "gocr_wasm.so", - "port": 10000, - "relative-deadline-us": 50000, - "argsize": 1, - "http-req-headers": [], - "http-req-content-type": "image/png", - "http-req-size": 10240, - "http-resp-headers": [], - "http-resp-size": 128, - "http-resp-content-type": "text/plain" -} \ No newline at end of file + "active": true, + "name": "gocr", + "path": "gocr_wasm.so", + "port": 10000, + "relative-deadline-us": 50000, + "argsize": 1, + "http-req-headers": [], + "http-req-content-type": "image/png", + "http-req-size": 10240, + "http-resp-headers": [], + "http-resp-size": 128, + "http-resp-content-type": "text/plain" +} diff --git a/runtime/tests/test_modules.json b/runtime/tests/test_modules.json index b7c7cb6..41e226b 100644 --- a/runtime/tests/test_modules.json +++ b/runtime/tests/test_modules.json @@ -1,160 +1,160 @@ -({ - "active": "no", - "name": "adpcm", - "path": "adpcm_wasm.so", - "port": 10000, - "relative-deadline-us": 50000, - "argsize": 2 -}, -{ - "active": "yes", - "name": "bitcount", - "path": "bitcount_wasm.so", - "port": 10002, - "relative-deadline-us": 50000, - "argsize": 2 -}, -{ - "active": "yes", - "name": "basic_math", - "path": "basic_math_wasm.so", - "port": 10004, - "relative-deadline-us": 50000, - "argsize": 1 -}, -{ - "active": "no", - "name": "binarytrees", - "path": "binarytrees_wasm.so", - "port": 10006, - "relative-deadline-us": 50000, - "argsize": 2 -}, -{ - "active": "no", - "name": "crc", - "path": "crc_wasm.so", - "port": 10008, - "relative-deadline-us": 50000, - "argsize": 2 -}, -{ - "active": "no", - "name": "dijkstra", - "path": "dijkstra_wasm.so", - "port": 10010, - "relative-deadline-us": 50000, - "argsize": 2 -}, -{ - "active": "no", - "name": "forever", - "path": "forever_wasm.so", - "port": 10012, - "relative-deadline-us": 50000, - "argsize": 1 -}, -{ - "active": "no", - "name": "fornever", - "path": "forever_wasm.so", - "port": 10014, - "relative-deadline-us": 50000, - "argsize": 2 -}, -{ - "active": "no", - "name": "fft", - "path": "fft_wasm.so", - "port": 10016, - "relative-deadline-us": 50000, - "argsize": 3 -}, -{ - "active": "no", - "name": "function_pointers", - "path": "function_pointers_wasm.so", - "port": 10018, - "relative-deadline-us": 50000, - "argsize": 1 -}, -{ - "active": "no", - "name": "gsm", - "path": "gsm_wasm.so", - "port": 10020, - "relative-deadline-us": 50000, - "argsize": 4 -}, -{ - "active": "no", - "name": "libjpeg", - "path": "libjpeg_wasm.so", - "port": 10022, - "relative-deadline-us": 50000, - "argsize": 1 -}, -{ - "active": "no", - "name": "mandelbrot", - "path": "mandelbrot_wasm.so", - "port": 10024, - "relative-deadline-us": 50000, - "argsize": 2 -}, -{ - "active": "no", - "name": "matrix_multiply", - "path": "matrix_multiply_wasm.so", - "port": 10026, - "relative-deadline-us": 50000, - "argsize": 1 -}, -{ - "active": "no", - "name": "particia", - "path": "partricia_wasm.so", - "port": 10028, - "relative-deadline-us": 50000, - "argsize": 2 -}, -{ - "active": "no", - "name": "sqlite", - "path": "sqlite_wasm.so", - "port": 10030, - "relative-deadline-us": 50000, - "argsize": 1 -}, -{ - "active": "yes", - "name": "stringsearch", - "path": "stringsearch_wasm.so", - "port": 10032, - "relative-deadline-us": 50000, - "argsize": 1 -}, -{ - "active": "no", - "name": "filesys", - "path": "filesys_wasm.so", - "port": 10034, - "relative-deadline-us": 50000, - "argsize": 3 -}, -{ - "active": "no", - "name": "sockserver", - "path": "sockserver_wasm.so", - "port": 10036, - "relative-deadline-us": 50000, - "argsize": 2 -}, -{ - "active": "no", - "name": "sockclient", - "path": "sockclient_wasm.so", - "port": 10038, - "relative-deadline-us": 50000, - "argsize": 3 -}) +{ + "active": false, + "name": "adpcm", + "path": "adpcm_wasm.so", + "port": 10000, + "relative-deadline-us": 50000, + "argsize": 2 +}, +{ + "active": true, + "name": "bitcount", + "path": "bitcount_wasm.so", + "port": 10002, + "relative-deadline-us": 50000, + "argsize": 2 +}, +{ + "active": true, + "name": "basic_math", + "path": "basic_math_wasm.so", + "port": 10004, + "relative-deadline-us": 50000, + "argsize": 1 +}, +{ + "active": false, + "name": "binarytrees", + "path": "binarytrees_wasm.so", + "port": 10006, + "relative-deadline-us": 50000, + "argsize": 2 +}, +{ + "active": false, + "name": "crc", + "path": "crc_wasm.so", + "port": 10008, + "relative-deadline-us": 50000, + "argsize": 2 +}, +{ + "active": false, + "name": "dijkstra", + "path": "dijkstra_wasm.so", + "port": 10010, + "relative-deadline-us": 50000, + "argsize": 2 +}, +{ + "active": false, + "name": "forever", + "path": "forever_wasm.so", + "port": 10012, + "relative-deadline-us": 50000, + "argsize": 1 +}, +{ + "active": false, + "name": "fornever", + "path": "forever_wasm.so", + "port": 10014, + "relative-deadline-us": 50000, + "argsize": 2 +}, +{ + "active": false, + "name": "fft", + "path": "fft_wasm.so", + "port": 10016, + "relative-deadline-us": 50000, + "argsize": 3 +}, +{ + "active": false, + "name": "function_pointers", + "path": "function_pointers_wasm.so", + "port": 10018, + "relative-deadline-us": 50000, + "argsize": 1 +}, +{ + "active": false, + "name": "gsm", + "path": "gsm_wasm.so", + "port": 10020, + "relative-deadline-us": 50000, + "argsize": 4 +}, +{ + "active": false, + "name": "libjpeg", + "path": "libjpeg_wasm.so", + "port": 10022, + "relative-deadline-us": 50000, + "argsize": 1 +}, +{ + "active": false, + "name": "mandelbrot", + "path": "mandelbrot_wasm.so", + "port": 10024, + "relative-deadline-us": 50000, + "argsize": 2 +}, +{ + "active": false, + "name": "matrix_multiply", + "path": "matrix_multiply_wasm.so", + "port": 10026, + "relative-deadline-us": 50000, + "argsize": 1 +}, +{ + "active": false, + "name": "particia", + "path": "partricia_wasm.so", + "port": 10028, + "relative-deadline-us": 50000, + "argsize": 2 +}, +{ + "active": false, + "name": "sqlite", + "path": "sqlite_wasm.so", + "port": 10030, + "relative-deadline-us": 50000, + "argsize": 1 +}, +{ + "active": true, + "name": "stringsearch", + "path": "stringsearch_wasm.so", + "port": 10032, + "relative-deadline-us": 50000, + "argsize": 1 +}, +{ + "active": false, + "name": "filesys", + "path": "filesys_wasm.so", + "port": 10034, + "relative-deadline-us": 50000, + "argsize": 3 +}, +{ + "active": false, + "name": "sockserver", + "path": "sockserver_wasm.so", + "port": 10036, + "relative-deadline-us": 50000, + "argsize": 2 +}, +{ + "active": false, + "name": "sockclient", + "path": "sockclient_wasm.so", + "port": 10038, + "relative-deadline-us": 50000, + "argsize": 3 +} diff --git a/runtime/tests/test_sodlpd.json b/runtime/tests/test_sodlpd.json index 69ab432..478d9a1 100644 --- a/runtime/tests/test_sodlpd.json +++ b/runtime/tests/test_sodlpd.json @@ -1,14 +1,14 @@ { - "active": "yes", - "name": "lpd", - "path": "lpd_wasm.so", - "port": 10000, - "relative-deadline-us": 50000, - "argsize": 1, - "http-req-headers": [], - "http-req-content-type": "image/jpeg", - "http-req-size": 102400, - "http-resp-headers": [], - "http-resp-size": 1048576, - "http-resp-content-type": "image/jpeg" -} \ No newline at end of file + "active": true, + "name": "lpd", + "path": "lpd_wasm.so", + "port": 10000, + "relative-deadline-us": 50000, + "argsize": 1, + "http-req-headers": [], + "http-req-content-type": "image/jpeg", + "http-req-size": 102400, + "http-resp-headers": [], + "http-resp-size": 1048576, + "http-resp-content-type": "image/jpeg" +} diff --git a/runtime/tests/test_sodresize.json b/runtime/tests/test_sodresize.json index 8fc29ae..99d11ed 100644 --- a/runtime/tests/test_sodresize.json +++ b/runtime/tests/test_sodresize.json @@ -1,14 +1,14 @@ { - "active": "yes", - "name": "resize", - "path": "resize_wasm.so", - "port": 10000, - "relative-deadline-us": 50000, - "argsize": 1, - "http-req-headers": [], - "http-req-content-type": "image/jpeg", - "http-req-size": 102400, - "http-resp-headers": [], - "http-resp-size": 102400, - "http-resp-content-type": "image/png" -} \ No newline at end of file + "active": true, + "name": "resize", + "path": "resize_wasm.so", + "port": 10000, + "relative-deadline-us": 50000, + "argsize": 1, + "http-req-headers": [], + "http-req-content-type": "image/jpeg", + "http-req-size": 102400, + "http-resp-headers": [], + "http-resp-size": 102400, + "http-resp-content-type": "image/png" +} diff --git a/runtime/tests/test_work.json b/runtime/tests/test_work.json index 43804b2..92d2807 100644 --- a/runtime/tests/test_work.json +++ b/runtime/tests/test_work.json @@ -1,14 +1,14 @@ { - "active": "yes", - "name": "work", - "path": "work_wasm.so", - "port": 10000, - "relative-deadline-us": 50000, - "argsize": 1, - "http-req-headers": [], - "http-req-content-type": "text/plain", - "http-req-size": 1048776, - "http-resp-headers": [], - "http-resp-size": 1048776, - "http-resp-content-type": "text/plain" -} \ No newline at end of file + "active": true, + "name": "work", + "path": "work_wasm.so", + "port": 10000, + "relative-deadline-us": 50000, + "argsize": 1, + "http-req-headers": [], + "http-req-content-type": "text/plain", + "http-req-size": 1048776, + "http-resp-headers": [], + "http-resp-size": 1048776, + "http-resp-content-type": "text/plain" +} diff --git a/runtime/tests/test_work100k.json b/runtime/tests/test_work100k.json index be69f24..aadae1d 100644 --- a/runtime/tests/test_work100k.json +++ b/runtime/tests/test_work100k.json @@ -1,14 +1,14 @@ { - "active": "yes", - "name": "work100k", - "path": "work100k_wasm.so", - "port": 10000, - "relative-deadline-us": 50000, - "argsize": 1, - "http-req-headers": [], - "http-req-content-type": "text/plain", - "http-req-size": 102600, - "http-resp-headers": [], - "http-resp-size": 102600, - "http-resp-content-type": "text/plain" -} \ No newline at end of file + "active": true, + "name": "work100k", + "path": "work100k_wasm.so", + "port": 10000, + "relative-deadline-us": 50000, + "argsize": 1, + "http-req-headers": [], + "http-req-content-type": "text/plain", + "http-req-size": 102600, + "http-resp-headers": [], + "http-resp-size": 102600, + "http-resp-content-type": "text/plain" +} diff --git a/runtime/tests/test_work10k.json b/runtime/tests/test_work10k.json index 67dd917..a46ba7c 100644 --- a/runtime/tests/test_work10k.json +++ b/runtime/tests/test_work10k.json @@ -1,14 +1,14 @@ { - "active": "yes", - "name": "work10k", - "path": "work10k_wasm.so", - "port": 10000, - "relative-deadline-us": 50000, - "argsize": 1, - "http-req-headers": [], - "http-req-content-type": "text/plain", - "http-req-size": 10480, - "http-resp-headers": [], - "http-resp-size": 10480, - "http-resp-content-type": "text/plain" -} \ No newline at end of file + "active": true, + "name": "work10k", + "path": "work10k_wasm.so", + "port": 10000, + "relative-deadline-us": 50000, + "argsize": 1, + "http-req-headers": [], + "http-req-content-type": "text/plain", + "http-req-size": 10480, + "http-resp-headers": [], + "http-resp-size": 10480, + "http-resp-content-type": "text/plain" +} diff --git a/runtime/tests/test_work1k.json b/runtime/tests/test_work1k.json index c2e37d9..bdf1c20 100644 --- a/runtime/tests/test_work1k.json +++ b/runtime/tests/test_work1k.json @@ -1,14 +1,14 @@ { - "active": "yes", - "name": "work1k", - "path": "work1k_wasm.so", - "port": 10000, - "relative-deadline-us": 50000, - "argsize": 1, - "http-req-headers": [], - "http-req-content-type": "text/plain", - "http-req-size": 1200, - "http-resp-headers": [], - "http-resp-size": 1200, - "http-resp-content-type": "text/plain" -} \ No newline at end of file + "active": true, + "name": "work1k", + "path": "work1k_wasm.so", + "port": 10000, + "relative-deadline-us": 50000, + "argsize": 1, + "http-req-headers": [], + "http-req-content-type": "text/plain", + "http-req-size": 1200, + "http-resp-headers": [], + "http-resp-size": 1200, + "http-resp-content-type": "text/plain" +} diff --git a/runtime/tests/test_work1m.json b/runtime/tests/test_work1m.json index d91bdc9..9caed19 100644 --- a/runtime/tests/test_work1m.json +++ b/runtime/tests/test_work1m.json @@ -1,14 +1,14 @@ { - "active": "yes", - "name": "work1m", - "path": "work1m_wasm.so", - "port": 10000, - "relative-deadline-us": 50000, - "argsize": 1, - "http-req-headers": [], - "http-req-content-type": "text/plain", - "http-req-size": 1048776, - "http-resp-headers": [], - "http-resp-size": 1048776, - "http-resp-content-type": "text/plain" -} \ No newline at end of file + "active": true, + "name": "work1m", + "path": "work1m_wasm.so", + "port": 10000, + "relative-deadline-us": 50000, + "argsize": 1, + "http-req-headers": [], + "http-req-content-type": "text/plain", + "http-req-size": 1048776, + "http-resp-headers": [], + "http-resp-size": 1048776, + "http-resp-content-type": "text/plain" +} From 2ad7711884a762a569b2c22c392075fc14585c53 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 24 Mar 2021 21:03:50 -0400 Subject: [PATCH 3/3] chore: update tests to handle stricter validation --- .../applications/ekf/by_iteration/spec.json | 3 +++ .../applications/ekf/one_iteration/spec.json | 1 + .../applications/imageclassification/spec.json | 1 + .../applications/imageresize/by_resolution/run.sh | 2 +- .../imageresize/by_resolution/spec.json | 3 +++ .../applications/imageresize/test/spec.json | 1 + .../licenseplate/by_plate_count/debug.sh | 2 +- .../licenseplate/by_plate_count/spec.json | 3 +++ .../experiments/applications/ocr/by_dpi/spec.json | 9 ++++++--- .../experiments/applications/ocr/by_font/spec.json | 13 ++++++++----- .../experiments/applications/ocr/by_word/spec.json | 13 ++++++++----- .../applications/ocr/fivebyeight/spec.json | 4 ++-- .../applications/ocr/handwriting/spec.json | 3 ++- runtime/experiments/applications/ocr/hyde/spec.json | 3 ++- runtime/src/module.c | 5 ++++- 15 files changed, 46 insertions(+), 20 deletions(-) diff --git a/runtime/experiments/applications/ekf/by_iteration/spec.json b/runtime/experiments/applications/ekf/by_iteration/spec.json index 0d45e40..ed1858d 100644 --- a/runtime/experiments/applications/ekf/by_iteration/spec.json +++ b/runtime/experiments/applications/ekf/by_iteration/spec.json @@ -3,6 +3,7 @@ "name": "ekf_first_iter", "path": "ekf_wasm.so", "port": 10000, + "expected-execution-us": 5000, "relative-deadline-us": 50000, "argsize": 1, "http-req-headers": [], @@ -17,6 +18,7 @@ "name": "ekf_second_iter", "path": "ekf_wasm.so", "port": 10001, + "expected-execution-us": 5000, "relative-deadline-us": 50000, "argsize": 1, "http-req-headers": [], @@ -31,6 +33,7 @@ "name": "ekf_third_iter", "path": "ekf_wasm.so", "port": 10002, + "expected-execution-us": 5000, "relative-deadline-us": 50000, "argsize": 1, "http-req-headers": [], diff --git a/runtime/experiments/applications/ekf/one_iteration/spec.json b/runtime/experiments/applications/ekf/one_iteration/spec.json index a98c2d3..7384d50 100644 --- a/runtime/experiments/applications/ekf/one_iteration/spec.json +++ b/runtime/experiments/applications/ekf/one_iteration/spec.json @@ -3,6 +3,7 @@ "name": "resize", "path": "ekf_wasm.so", "port": 10000, + "expected-execution-us": 5000, "relative-deadline-us": 50000, "argsize": 1, "http-req-headers": [], diff --git a/runtime/experiments/applications/imageclassification/spec.json b/runtime/experiments/applications/imageclassification/spec.json index 32ef760..6d08e30 100644 --- a/runtime/experiments/applications/imageclassification/spec.json +++ b/runtime/experiments/applications/imageclassification/spec.json @@ -3,6 +3,7 @@ "name": "cifar10", "path": "cifar10_wasm.so", "port": 10000, + "expected-execution-us": 5000, "relative-deadline-us": 50000, "argsize": 1, "http-req-headers": [], diff --git a/runtime/experiments/applications/imageresize/by_resolution/run.sh b/runtime/experiments/applications/imageresize/by_resolution/run.sh index 294fb92..6303c73 100755 --- a/runtime/experiments/applications/imageresize/by_resolution/run.sh +++ b/runtime/experiments/applications/imageresize/by_resolution/run.sh @@ -51,7 +51,7 @@ for ((i = 0; i < total_count; i++)); do done echo "$success_count / $total_count" -rm result_*.png +rm -f result_*.png if [ "$1" != "-d" ]; then sleep 5 diff --git a/runtime/experiments/applications/imageresize/by_resolution/spec.json b/runtime/experiments/applications/imageresize/by_resolution/spec.json index 3da8650..283c0e5 100644 --- a/runtime/experiments/applications/imageresize/by_resolution/spec.json +++ b/runtime/experiments/applications/imageresize/by_resolution/spec.json @@ -3,6 +3,7 @@ "name": "resize_small", "path": "resize_wasm.so", "port": 10000, + "expected-execution-us": 5000, "relative-deadline-us": 50000, "argsize": 1, "http-req-headers": [], @@ -17,6 +18,7 @@ "name": "resize_medium", "path": "resize_wasm.so", "port": 10001, + "expected-execution-us": 5000, "relative-deadline-us": 50000, "argsize": 1, "http-req-headers": [], @@ -31,6 +33,7 @@ "name": "resize_large", "path": "resize_wasm.so", "port": 10002, + "expected-execution-us": 5000, "relative-deadline-us": 50000, "argsize": 1, "http-req-headers": [], diff --git a/runtime/experiments/applications/imageresize/test/spec.json b/runtime/experiments/applications/imageresize/test/spec.json index 7ec404a..de67977 100644 --- a/runtime/experiments/applications/imageresize/test/spec.json +++ b/runtime/experiments/applications/imageresize/test/spec.json @@ -3,6 +3,7 @@ "name": "resize", "path": "resize_wasm.so", "port": 10000, + "expected-execution-us": 5000, "relative-deadline-us": 50000, "argsize": 1, "http-req-headers": [], diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/debug.sh b/runtime/experiments/applications/licenseplate/by_plate_count/debug.sh index a561392..6ab3666 100755 --- a/runtime/experiments/applications/licenseplate/by_plate_count/debug.sh +++ b/runtime/experiments/applications/licenseplate/by_plate_count/debug.sh @@ -5,7 +5,7 @@ # Also disables pagination and stopping on SIGUSR1 experiment_directory=$(pwd) -project_directory=$(cd ../../.. && pwd) +project_directory=$(cd ../../../.. && pwd) binary_directory=$(cd "$project_directory"/bin && pwd) export LD_LIBRARY_PATH="$binary_directory:$LD_LIBRARY_PATH" diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/spec.json b/runtime/experiments/applications/licenseplate/by_plate_count/spec.json index 4860426..0d106d3 100644 --- a/runtime/experiments/applications/licenseplate/by_plate_count/spec.json +++ b/runtime/experiments/applications/licenseplate/by_plate_count/spec.json @@ -3,6 +3,7 @@ "name": "lpd1", "path": "lpd_wasm.so", "port": 10000, + "expected-execution-us": 5000, "relative-deadline-us": 50000, "argsize": 1, "http-req-headers": [], @@ -17,6 +18,7 @@ "name": "lpd2", "path": "lpd_wasm.so", "port": 10001, + "expected-execution-us": 5000, "relative-deadline-us": 50000, "argsize": 1, "http-req-headers": [], @@ -31,6 +33,7 @@ "name": "lpd4", "path": "lpd_wasm.so", "port": 10002, + "expected-execution-us": 5000, "relative-deadline-us": 50000, "argsize": 1, "http-req-headers": [], diff --git a/runtime/experiments/applications/ocr/by_dpi/spec.json b/runtime/experiments/applications/ocr/by_dpi/spec.json index 6811c40..4b08dff 100644 --- a/runtime/experiments/applications/ocr/by_dpi/spec.json +++ b/runtime/experiments/applications/ocr/by_dpi/spec.json @@ -3,7 +3,8 @@ "name": "gocr_72_dpi", "path": "gocr_wasm.so", "port": 10000, - "relative-deadline-us": 50000000000, + "expected-execution-us": 5000, + "relative-deadline-us": 36000, "argsize": 1, "http-req-headers": [], "http-req-content-type": "text/plain", @@ -17,7 +18,8 @@ "name": "gocr_108_dpi", "path": "gocr_wasm.so", "port": 10001, - "relative-deadline-us": 50000000000, + "expected-execution-us": 5000, + "relative-deadline-us": 36000, "argsize": 1, "http-req-headers": [], "http-req-content-type": "text/plain", @@ -31,7 +33,8 @@ "name": "gocr_144_dpi", "path": "gocr_wasm.so", "port": 10002, - "relative-deadline-us": 50000000000, + "expected-execution-us": 5000, + "relative-deadline-us": 36000, "argsize": 1, "http-req-headers": [], "http-req-content-type": "text/plain", diff --git a/runtime/experiments/applications/ocr/by_font/spec.json b/runtime/experiments/applications/ocr/by_font/spec.json index ebfd967..18cea93 100644 --- a/runtime/experiments/applications/ocr/by_font/spec.json +++ b/runtime/experiments/applications/ocr/by_font/spec.json @@ -1,9 +1,10 @@ -({ +{ "active": true, "name": "gocr_mono", "path": "gocr_wasm.so", "port": 10000, - "relative-deadline-us": 50000000000, + "expected-execution-us": 5000, + "relative-deadline-us": 36000, "argsize": 1, "http-req-headers": [], "http-req-content-type": "text/plain", @@ -17,7 +18,8 @@ "name": "gocr_urw_gothic", "path": "gocr_wasm.so", "port": 10001, - "relative-deadline-us": 50000000000, + "expected-execution-us": 5000, + "relative-deadline-us": 36000, "argsize": 1, "http-req-headers": [], "http-req-content-type": "text/plain", @@ -31,7 +33,8 @@ "name": "gocr_lobster_2", "path": "gocr_wasm.so", "port": 10002, - "relative-deadline-us": 50000000000, + "expected-execution-us": 5000, + "relative-deadline-us": 36000, "argsize": 1, "http-req-headers": [], "http-req-content-type": "text/plain", @@ -39,4 +42,4 @@ "http-resp-headers": [], "http-resp-size": 5335057, "http-resp-content-type": "text/plain" -}) +} diff --git a/runtime/experiments/applications/ocr/by_word/spec.json b/runtime/experiments/applications/ocr/by_word/spec.json index 8cf921b..6bde0e1 100644 --- a/runtime/experiments/applications/ocr/by_word/spec.json +++ b/runtime/experiments/applications/ocr/by_word/spec.json @@ -1,9 +1,10 @@ -({ +{ "active": true, "name": "gocr_1_word", "path": "gocr_wasm.so", "port": 10000, - "relative-deadline-us": 50000000000, + "expected-execution-us": 5000, + "relative-deadline-us": 36000, "argsize": 1, "http-req-headers": [], "http-req-content-type": "text/plain", @@ -17,7 +18,8 @@ "name": "gocr_10_words", "path": "gocr_wasm.so", "port": 10001, - "relative-deadline-us": 50000000000, + "expected-execution-us": 5000, + "relative-deadline-us": 36000, "argsize": 1, "http-req-headers": [], "http-req-content-type": "text/plain", @@ -31,7 +33,8 @@ "name": "gocr_100_words", "path": "gocr_wasm.so", "port": 10002, - "relative-deadline-us": 50000000000, + "expected-execution-us": 5000, + "relative-deadline-us": 36000, "argsize": 1, "http-req-headers": [], "http-req-content-type": "text/plain", @@ -39,4 +42,4 @@ "http-resp-headers": [], "http-resp-size": 5335057, "http-resp-content-type": "text/plain" -}) +} diff --git a/runtime/experiments/applications/ocr/fivebyeight/spec.json b/runtime/experiments/applications/ocr/fivebyeight/spec.json index bc2005c..335243a 100644 --- a/runtime/experiments/applications/ocr/fivebyeight/spec.json +++ b/runtime/experiments/applications/ocr/fivebyeight/spec.json @@ -3,8 +3,8 @@ "name": "gocr", "path": "gocr_wasm.so", "port": 10000, - "relative-deadline-us": 500000000, - "expected-execution-us": 5000000, + "expected-execution-us": 5000, + "relative-deadline-us": 36000, "argsize": 1, "http-req-headers": [], "http-req-content-type": "text/plain", diff --git a/runtime/experiments/applications/ocr/handwriting/spec.json b/runtime/experiments/applications/ocr/handwriting/spec.json index f2ab4f6..335243a 100644 --- a/runtime/experiments/applications/ocr/handwriting/spec.json +++ b/runtime/experiments/applications/ocr/handwriting/spec.json @@ -3,7 +3,8 @@ "name": "gocr", "path": "gocr_wasm.so", "port": 10000, - "relative-deadline-us": 50000000000, + "expected-execution-us": 5000, + "relative-deadline-us": 36000, "argsize": 1, "http-req-headers": [], "http-req-content-type": "text/plain", diff --git a/runtime/experiments/applications/ocr/hyde/spec.json b/runtime/experiments/applications/ocr/hyde/spec.json index 4c90d23..f413591 100644 --- a/runtime/experiments/applications/ocr/hyde/spec.json +++ b/runtime/experiments/applications/ocr/hyde/spec.json @@ -3,7 +3,8 @@ "name": "gocr", "path": "gocr_wasm.so", "port": 10000, - "relative-deadline-us": 50000000000, + "expected-execution-us": 5000, + "relative-deadline-us": 360000, "argsize": 1, "http-req-headers": [], "http-req-content-type": "text/plain", diff --git a/runtime/src/module.c b/runtime/src/module.c index 893bf73..669f94b 100644 --- a/runtime/src/module.c +++ b/runtime/src/module.c @@ -488,8 +488,11 @@ module_new_from_json(char *file_name) } i += ntoks; - /* Validate presence of required fields */ + /* If the ratio is too big, admissions control is too coarse */ + uint32_t ratio = relative_deadline_us / expected_execution_us; + if (ratio > 1000000) panic("Ratio of Deadline to Execution time cannot exceed 1000000"); + /* Validate presence of required fields */ if (strlen(module_name) == 0) panic("name field is required\n"); if (strlen(module_path) == 0) panic("path field is required\n"); if (port == 0) panic("port field is required\n");