chore: validation and active as boolean

main
Sean McBride 4 years ago
parent 5968d9b72e
commit 86b1a274e9

@ -60,10 +60,12 @@ An SLEdge serverless function consists of a shared library (\*.so) and a JSON co
```json ```json
{ {
"active": "yes", "active": true,
"name": "fibonacci", "name": "fibonacci",
"path": "fibonacci_wasm.so", "path": "fibonacci_wasm.so",
"port": 10000, "port": 10000,
"expected-execution-us": 600,
"relative-deadline-us": 2000,
"argsize": 1, "argsize": 1,
"http-req-headers": [], "http-req-headers": [],
"http-req-content-type": "text/plain", "http-req-content-type": "text/plain",

@ -1,5 +1,5 @@
{ {
"active": "yes", "active": true,
"name": "ekf_first_iter", "name": "ekf_first_iter",
"path": "ekf_wasm.so", "path": "ekf_wasm.so",
"port": 10000, "port": 10000,
@ -13,7 +13,7 @@
"http-resp-content-type": "application/octet-stream" "http-resp-content-type": "application/octet-stream"
}, },
{ {
"active": "yes", "active": true,
"name": "ekf_second_iter", "name": "ekf_second_iter",
"path": "ekf_wasm.so", "path": "ekf_wasm.so",
"port": 10001, "port": 10001,
@ -27,7 +27,7 @@
"http-resp-content-type": "application/octet-stream" "http-resp-content-type": "application/octet-stream"
}, },
{ {
"active": "yes", "active": true,
"name": "ekf_third_iter", "name": "ekf_third_iter",
"path": "ekf_wasm.so", "path": "ekf_wasm.so",
"port": 10002, "port": 10002,

@ -1,5 +1,5 @@
{ {
"active": "yes", "active": true,
"name": "resize", "name": "resize",
"path": "ekf_wasm.so", "path": "ekf_wasm.so",
"port": 10000, "port": 10000,

@ -1,14 +1,14 @@
{ {
"active": "yes", "active": true,
"name": "cifar10", "name": "cifar10",
"path": "cifar10_wasm.so", "path": "cifar10_wasm.so",
"port": 10000, "port": 10000,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 1, "argsize": 1,
"http-req-headers": [], "http-req-headers": [],
"http-req-content-type": "image/png", "http-req-content-type": "image/png",
"http-req-size": 4096, "http-req-size": 4096,
"http-resp-headers": [], "http-resp-headers": [],
"http-resp-size": 128, "http-resp-size": 128,
"http-resp-content-type": "text/plain" "http-resp-content-type": "text/plain"
} }

@ -1,5 +1,5 @@
{ {
"active": "yes", "active": true,
"name": "resize_small", "name": "resize_small",
"path": "resize_wasm.so", "path": "resize_wasm.so",
"port": 10000, "port": 10000,
@ -11,9 +11,9 @@
"http-resp-headers": [], "http-resp-headers": [],
"http-resp-size": 1024000, "http-resp-size": 1024000,
"http-resp-content-type": "image/png" "http-resp-content-type": "image/png"
} },
{ {
"active": "yes", "active": true,
"name": "resize_medium", "name": "resize_medium",
"path": "resize_wasm.so", "path": "resize_wasm.so",
"port": 10001, "port": 10001,
@ -25,9 +25,9 @@
"http-resp-headers": [], "http-resp-headers": [],
"http-resp-size": 1024000, "http-resp-size": 1024000,
"http-resp-content-type": "image/png" "http-resp-content-type": "image/png"
} },
{ {
"active": "yes", "active": true,
"name": "resize_large", "name": "resize_large",
"path": "resize_wasm.so", "path": "resize_wasm.so",
"port": 10002, "port": 10002,

@ -1,5 +1,5 @@
{ {
"active": "yes", "active": true,
"name": "resize", "name": "resize",
"path": "resize_wasm.so", "path": "resize_wasm.so",
"port": 10000, "port": 10000,

@ -1,5 +1,5 @@
{ {
"active": "yes", "active": true,
"name": "lpd1", "name": "lpd1",
"path": "lpd_wasm.so", "path": "lpd_wasm.so",
"port": 10000, "port": 10000,
@ -13,7 +13,7 @@
"http-resp-content-type": "text/plain" "http-resp-content-type": "text/plain"
}, },
{ {
"active": "yes", "active": true,
"name": "lpd2", "name": "lpd2",
"path": "lpd_wasm.so", "path": "lpd_wasm.so",
"port": 10001, "port": 10001,
@ -27,7 +27,7 @@
"http-resp-content-type": "text/plain" "http-resp-content-type": "text/plain"
}, },
{ {
"active": "yes", "active": true,
"name": "lpd4", "name": "lpd4",
"path": "lpd_wasm.so", "path": "lpd_wasm.so",
"port": 10002, "port": 10002,

@ -1,5 +1,5 @@
{ {
"active": "yes", "active": true,
"name": "gocr_72_dpi", "name": "gocr_72_dpi",
"path": "gocr_wasm.so", "path": "gocr_wasm.so",
"port": 10000, "port": 10000,
@ -13,7 +13,7 @@
"http-resp-content-type": "text/plain" "http-resp-content-type": "text/plain"
}, },
{ {
"active": "yes", "active": true,
"name": "gocr_108_dpi", "name": "gocr_108_dpi",
"path": "gocr_wasm.so", "path": "gocr_wasm.so",
"port": 10001, "port": 10001,
@ -27,7 +27,7 @@
"http-resp-content-type": "text/plain" "http-resp-content-type": "text/plain"
}, },
{ {
"active": "yes", "active": true,
"name": "gocr_144_dpi", "name": "gocr_144_dpi",
"path": "gocr_wasm.so", "path": "gocr_wasm.so",
"port": 10002, "port": 10002,

@ -1,5 +1,5 @@
{ ({
"active": "yes", "active": true,
"name": "gocr_mono", "name": "gocr_mono",
"path": "gocr_wasm.so", "path": "gocr_wasm.so",
"port": 10000, "port": 10000,
@ -13,7 +13,7 @@
"http-resp-content-type": "text/plain" "http-resp-content-type": "text/plain"
}, },
{ {
"active": "yes", "active": true,
"name": "gocr_urw_gothic", "name": "gocr_urw_gothic",
"path": "gocr_wasm.so", "path": "gocr_wasm.so",
"port": 10001, "port": 10001,
@ -27,7 +27,7 @@
"http-resp-content-type": "text/plain" "http-resp-content-type": "text/plain"
}, },
{ {
"active": "yes", "active": true,
"name": "gocr_lobster_2", "name": "gocr_lobster_2",
"path": "gocr_wasm.so", "path": "gocr_wasm.so",
"port": 10002, "port": 10002,
@ -39,4 +39,4 @@
"http-resp-headers": [], "http-resp-headers": [],
"http-resp-size": 5335057, "http-resp-size": 5335057,
"http-resp-content-type": "text/plain" "http-resp-content-type": "text/plain"
} })

@ -1,5 +1,5 @@
{ ({
"active": "yes", "active": true,
"name": "gocr_1_word", "name": "gocr_1_word",
"path": "gocr_wasm.so", "path": "gocr_wasm.so",
"port": 10000, "port": 10000,
@ -13,7 +13,7 @@
"http-resp-content-type": "text/plain" "http-resp-content-type": "text/plain"
}, },
{ {
"active": "yes", "active": true,
"name": "gocr_10_words", "name": "gocr_10_words",
"path": "gocr_wasm.so", "path": "gocr_wasm.so",
"port": 10001, "port": 10001,
@ -27,7 +27,7 @@
"http-resp-content-type": "text/plain" "http-resp-content-type": "text/plain"
}, },
{ {
"active": "yes", "active": true,
"name": "gocr_100_words", "name": "gocr_100_words",
"path": "gocr_wasm.so", "path": "gocr_wasm.so",
"port": 10002, "port": 10002,
@ -39,4 +39,4 @@
"http-resp-headers": [], "http-resp-headers": [],
"http-resp-size": 5335057, "http-resp-size": 5335057,
"http-resp-content-type": "text/plain" "http-resp-content-type": "text/plain"
} })

@ -1,5 +1,5 @@
{ {
"active": "yes", "active": true,
"name": "gocr", "name": "gocr",
"path": "gocr_wasm.so", "path": "gocr_wasm.so",
"port": 10000, "port": 10000,

@ -1,5 +1,5 @@
{ {
"active": "yes", "active": true,
"name": "gocr", "name": "gocr",
"path": "gocr_wasm.so", "path": "gocr_wasm.so",
"port": 10000, "port": 10000,

@ -1,5 +1,5 @@
{ {
"active": "yes", "active": true,
"name": "gocr", "name": "gocr",
"path": "gocr_wasm.so", "path": "gocr_wasm.so",
"port": 10000, "port": 10000,

@ -1,5 +1,5 @@
{ {
"active": "yes", "active": true,
"name": "gocr", "name": "gocr",
"path": "gocr.aso", "path": "gocr.aso",
"port": 10000, "port": 10000,
@ -13,7 +13,7 @@
"http-resp-content-type": "text/plain" "http-resp-content-type": "text/plain"
}, },
{ {
"active": "yes", "active": true,
"name": "gocr", "name": "gocr",
"path": "gocr.aso", "path": "gocr.aso",
"port": 10001, "port": 10001,
@ -27,7 +27,7 @@
"http-resp-content-type": "text/plain" "http-resp-content-type": "text/plain"
}, },
{ {
"active": "yes", "active": true,
"name": "gocr", "name": "gocr",
"path": "gocr.aso", "path": "gocr.aso",
"port": 10002, "port": 10002,
@ -40,4 +40,3 @@
"http-resp-size": 5335057, "http-resp-size": 5335057,
"http-resp-content-type": "text/plain" "http-resp-content-type": "text/plain"
} }

@ -1,5 +1,5 @@
{ {
"active": "yes", "active": true,
"name": "hello_ps", "name": "hello_ps",
"path": "hello_ps_wasm.so", "path": "hello_ps_wasm.so",
"port": 10000, "port": 10000,

@ -1,14 +1,14 @@
{ {
"active": "yes", "active": true,
"name": "empty", "name": "empty",
"path": "empty_wasm.so", "path": "empty_wasm.so",
"port": 10000, "port": 10000,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 1, "argsize": 1,
"http-req-headers": [], "http-req-headers": [],
"http-req-content-type": "text/plain", "http-req-content-type": "text/plain",
"http-req-size": 1024, "http-req-size": 1024,
"http-resp-headers": [], "http-resp-headers": [],
"http-resp-size": 1024, "http-resp-size": 1024,
"http-resp-content-type": "text/plain" "http-resp-content-type": "text/plain"
} }

@ -1,5 +1,5 @@
{ {
"active": "yes", "active": true,
"name": "fibonacci_10", "name": "fibonacci_10",
"path": "fibonacci_wasm.so", "path": "fibonacci_wasm.so",
"port": 10010, "port": 10010,
@ -15,7 +15,7 @@
"http-resp-content-type": "text/plain" "http-resp-content-type": "text/plain"
}, },
{ {
"active": "yes", "active": true,
"name": "fibonacci_40", "name": "fibonacci_40",
"path": "fibonacci_wasm.so", "path": "fibonacci_wasm.so",
"port": 10040, "port": 10040,

@ -1,60 +1,60 @@
{ {
"active": "yes", "active": true,
"name": "work1k", "name": "work1k",
"path": "work1k_wasm.so", "path": "work1k_wasm.so",
"port": 10000, "port": 10000,
"expected-execution-us": 400, "expected-execution-us": 400,
"relative-deadline-us": 2000, "relative-deadline-us": 2000,
"argsize": 1, "argsize": 1,
"http-req-headers": [], "http-req-headers": [],
"http-req-content-type": "text/plain", "http-req-content-type": "text/plain",
"http-req-size": 1548, "http-req-size": 1548,
"http-resp-headers": [], "http-resp-headers": [],
"http-resp-size": 1548, "http-resp-size": 1548,
"http-resp-content-type": "text/plain" "http-resp-content-type": "text/plain"
}, },
{ {
"active": "yes", "active": true,
"name": "work10k", "name": "work10k",
"path": "work10k_wasm.so", "path": "work10k_wasm.so",
"port": 10001, "port": 10001,
"expected-execution-us": 600, "expected-execution-us": 600,
"relative-deadline-us": 2000, "relative-deadline-us": 2000,
"argsize": 1, "argsize": 1,
"http-req-headers": [], "http-req-headers": [],
"http-req-content-type": "text/plain", "http-req-content-type": "text/plain",
"http-req-size": 10480, "http-req-size": 10480,
"http-resp-headers": [], "http-resp-headers": [],
"http-resp-size": 10480, "http-resp-size": 10480,
"http-resp-content-type": "text/plain" "http-resp-content-type": "text/plain"
}, },
{ {
"active": "yes", "active": true,
"name": "work100k", "name": "work100k",
"path": "work100k_wasm.so", "path": "work100k_wasm.so",
"port": 10002, "port": 10002,
"expected-execution-us": 700, "expected-execution-us": 700,
"relative-deadline-us": 2000, "relative-deadline-us": 2000,
"argsize": 1, "argsize": 1,
"http-req-headers": [], "http-req-headers": [],
"http-req-content-type": "text/plain", "http-req-content-type": "text/plain",
"http-req-size": 104800, "http-req-size": 104800,
"http-resp-headers": [], "http-resp-headers": [],
"http-resp-size": 104800, "http-resp-size": 104800,
"http-resp-content-type": "text/plain" "http-resp-content-type": "text/plain"
}, },
{ {
"active": "yes", "active": true,
"name": "work1m", "name": "work1m",
"path": "work1m_wasm.so", "path": "work1m_wasm.so",
"port": 10003, "port": 10003,
"expected-execution-us": 2000, "expected-execution-us": 2000,
"relative-deadline-us": 6000, "relative-deadline-us": 6000,
"argsize": 1, "argsize": 1,
"http-req-headers": [], "http-req-headers": [],
"http-req-content-type": "text/plain", "http-req-content-type": "text/plain",
"http-req-size": 1048776, "http-req-size": 1048776,
"http-resp-headers": [], "http-resp-headers": [],
"http-resp-size": 1048776, "http-resp-size": 1048776,
"http-resp-content-type": "text/plain" "http-resp-content-type": "text/plain"
} }

@ -1,5 +1,5 @@
{ {
"active": "yes", "active": true,
"name": "fibonacci_10", "name": "fibonacci_10",
"path": "fibonacci_wasm.so", "path": "fibonacci_wasm.so",
"port": 10010, "port": 10010,
@ -14,7 +14,7 @@
"http-resp-content-type": "text/plain" "http-resp-content-type": "text/plain"
}, },
{ {
"active": "yes", "active": true,
"name": "fibonacci_40", "name": "fibonacci_40",
"path": "fibonacci_wasm.so", "path": "fibonacci_wasm.so",
"port": 10040, "port": 10040,

@ -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) uint64_t admissions_estimate = (estimated_execution * (uint64_t)ADMISSIONS_CONTROL_GRANULARITY)
/ relative_deadline; / relative_deadline;
if (admissions_estimate == 0) 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; return admissions_estimate;
#else #else

@ -8,13 +8,26 @@
#include "likely.h" #include "likely.h"
#include "types.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 LISTENER_THREAD_MAX_EPOLL_EVENTS 128
#define RUNTIME_LOG_FILE "sledge.log" #define RUNTIME_LOG_FILE "sledge.log"
#define RUNTIME_MAX_SANDBOX_REQUEST_COUNT (1 << 19) /* random! */ /* random! */
#define RUNTIME_MAX_SANDBOX_REQUEST_COUNT (1 << 19)
#define RUNTIME_READ_WRITE_VECTOR_LENGTH 16 #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 * 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. * 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 * See runtime_get_processor_speed_MHz for further details
*/ */
extern uint32_t runtime_processor_speed_MHz; 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 */ /* Count of worker threads and array of their pthread identifiers */
extern pthread_t runtime_worker_threads[]; extern pthread_t runtime_worker_threads[];

@ -26,11 +26,10 @@
/* Conditionally used by debuglog when NDEBUG is not set */ /* Conditionally used by debuglog when NDEBUG is not set */
int32_t debuglog_file_descriptor = -1; int32_t debuglog_file_descriptor = -1;
uint32_t runtime_processor_speed_MHz = 0; 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_total_online_processors = 0; uint32_t runtime_worker_threads_count = 0;
uint32_t runtime_worker_threads_count = 0; const uint32_t runtime_first_worker_processor = 1;
const uint32_t runtime_first_worker_processor = 1;
/* TODO: the worker never actually records state here */ /* 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 */ 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]; pthread_t runtime_worker_threads[WORKER_THREAD_CORE_COUNT];
@ -255,7 +254,6 @@ log_compiletime_config()
printf("\tArchitecture: %s\n", "x86_64"); printf("\tArchitecture: %s\n", "x86_64");
#endif #endif
// TODO: Static assertion of define
int ncores = NCORES; int ncores = NCORES;
printf("\tTotal Cores: %d\n", ncores); printf("\tTotal Cores: %d\n", ncores);
int page_size = PAGE_SIZE; int page_size = PAGE_SIZE;
@ -354,10 +352,6 @@ main(int argc, char **argv)
runtime_processor_speed_MHz = runtime_get_processor_speed_MHz(); runtime_processor_speed_MHz = runtime_get_processor_speed_MHz();
if (unlikely(runtime_processor_speed_MHz == 0)) panic("Failed to detect processor speed\n"); 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 software_interrupt_interval_duration_in_cycles = (uint64_t)SOFTWARE_INTERRUPT_INTERVAL_DURATION_IN_USEC
* runtime_processor_speed_MHz; * runtime_processor_speed_MHz;
printf("\tProcessor Speed: %u MHz\n", runtime_processor_speed_MHz); printf("\tProcessor Speed: %u MHz\n", runtime_processor_speed_MHz);

@ -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; module->relative_deadline_us = relative_deadline_us;
/* This should have been handled when a module was loaded */ /* 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 */ /* This can overflow a uint32_t, so be sure to cast appropriately */
module->relative_deadline = (uint64_t)relative_deadline_us * runtime_processor_speed_MHz; 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) if (argument_count < 0 || argument_count > 127)
panic("Expected argument count between 0 and 127, saw %d\n", argument_count); panic("Expected argument count between 0 and 127, saw %d\n", argument_count);
} else if (strcmp(key, "active") == 0) { } 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; is_active = true;
} else if (strcmp(val, "no") == 0) { } else if (val[0] == 'f') {
is_active = false; is_active = false;
} else { } 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) { } else if (strcmp(key, "relative-deadline-us") == 0) {
// Panic on overflow
// TODO: Consider underflow
int64_t buffer = strtoll(val, NULL, 10); int64_t buffer = strtoll(val, NULL, 10);
if (buffer < 0 || buffer > (int64_t)runtime_relative_deadline_us_max) if (buffer < 0 || buffer > (int64_t)RUNTIME_RELATIVE_DEADLINE_US_MAX)
panic("Relative-deadline-us must be between 0 and %lu, was %ld\n", panic("Relative-deadline-us must be between 0 and %ld, was %ld\n",
runtime_relative_deadline_us_max, buffer); (int64_t)RUNTIME_RELATIVE_DEADLINE_US_MAX, buffer);
relative_deadline_us = (uint32_t)buffer; relative_deadline_us = (uint32_t)buffer;
} else if (strcmp(key, "expected-execution-us") == 0) { } else if (strcmp(key, "expected-execution-us") == 0) {
// Panic on overflow int64_t buffer = strtoll(val, NULL, 10);
// TODO: Consider underflow if (buffer < 0 || buffer > (int64_t)RUNTIME_EXPECTED_EXECUTION_US_MAX)
debuglog("expected-execution-us: %s\n", val); panic("Relative-deadline-us must be between 0 and %ld, was %ld\n",
unsigned long long buffer = strtoull(val, NULL, 10); (int64_t)RUNTIME_EXPECTED_EXECUTION_US_MAX, buffer);
if (buffer > UINT32_MAX)
panic("Max expected-execution-us is %u, but entry was %llu\n", UINT32_MAX,
buffer);
expected_execution_us = (uint32_t)buffer; expected_execution_us = (uint32_t)buffer;
} else if (strcmp(key, "admissions-percentile") == 0) { } 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) 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; admissions_percentile = (int)buffer;
} else if (strcmp(key, "http-req-headers") == 0) { } else if (strcmp(key, "http-req-headers") == 0) {
assert(tokens[i + j + 1].type == JSMN_ARRAY); 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); strncpy(r, file_buffer + g->start, g->end - g->start);
} }
} else if (strcmp(key, "http-req-size") == 0) { } 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) { } 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) { } 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); strcpy(request_content_type, val);
} else if (strcmp(key, "http-resp-content-type") == 0) { } 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); strcpy(response_content_type, val);
} else { } else {
#ifdef LOG_MODULE_LOADING #ifdef LOG_MODULE_LOADING
@ -521,7 +525,7 @@ module_new_from_json(char *file_name)
free(reponse_headers); 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 #ifdef LOG_MODULE_LOADING
debuglog("Loaded %d module%s!\n", module_count, module_count > 1 ? "s" : ""); debuglog("Loaded %d module%s!\n", module_count, module_count > 1 ? "s" : "");
#endif #endif

@ -1,14 +1,14 @@
{ {
"active": "yes", "active": true,
"name": "fibonacci", "name": "fibonacci",
"path": "fibonacci_wasm.so", "path": "fibonacci_wasm.so",
"port": 10000, "port": 10000,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 1, "argsize": 1,
"http-req-headers": [], "http-req-headers": [],
"http-req-content-type": "text/plain", "http-req-content-type": "text/plain",
"http-req-size": 1024, "http-req-size": 1024,
"http-resp-headers": [], "http-resp-headers": [],
"http-resp-size": 1024, "http-resp-size": 1024,
"http-resp-content-type": "text/plain" "http-resp-content-type": "text/plain"
} }

@ -1,5 +1,5 @@
{ {
"active": "yes", "active": true,
"name": "fibonacci", "name": "fibonacci",
"path": "fibonacci_wasm.so", "path": "fibonacci_wasm.so",
"port": 10000, "port": 10000,
@ -13,7 +13,7 @@
"http-resp-content-type": "text/plain" "http-resp-content-type": "text/plain"
}, },
{ {
"active": "yes", "active": true,
"name": "fibonacci2", "name": "fibonacci2",
"path": "fibonacci_wasm.so", "path": "fibonacci_wasm.so",
"port": 10001, "port": 10001,

@ -1,14 +1,14 @@
{ {
"active": "yes", "active": true,
"name": "cifar10", "name": "cifar10",
"path": "cifar10_wasm.so", "path": "cifar10_wasm.so",
"port": 10000, "port": 10000,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 1, "argsize": 1,
"http-req-headers": [], "http-req-headers": [],
"http-req-content-type": "image/png", "http-req-content-type": "image/png",
"http-req-size": 4096, "http-req-size": 4096,
"http-resp-headers": [], "http-resp-headers": [],
"http-resp-size": 128, "http-resp-size": 128,
"http-resp-content-type": "text/plain" "http-resp-content-type": "text/plain"
} }

@ -1,14 +1,14 @@
{ {
"active": "yes", "active": true,
"name": "empty", "name": "empty",
"path": "empty_wasm.so", "path": "empty_wasm.so",
"port": 10000, "port": 10000,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 1, "argsize": 1,
"http-req-headers": [], "http-req-headers": [],
"http-req-content-type": "text/plain", "http-req-content-type": "text/plain",
"http-req-size": 1024, "http-req-size": 1024,
"http-resp-headers": [], "http-resp-headers": [],
"http-resp-size": 1024, "http-resp-size": 1024,
"http-resp-content-type": "text/plain" "http-resp-content-type": "text/plain"
} }

@ -1,5 +1,5 @@
{ {
"active": "yes", "active": true,
"name": "fibonacci", "name": "fibonacci",
"path": "fibonacci_wasm.so", "path": "fibonacci_wasm.so",
"port": 10000, "port": 10000,

@ -1,14 +1,14 @@
{ {
"active": "yes", "active": true,
"name": "gocr", "name": "gocr",
"path": "gocr_wasm.so", "path": "gocr_wasm.so",
"port": 10000, "port": 10000,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 1, "argsize": 1,
"http-req-headers": [], "http-req-headers": [],
"http-req-content-type": "image/png", "http-req-content-type": "image/png",
"http-req-size": 10240, "http-req-size": 10240,
"http-resp-headers": [], "http-resp-headers": [],
"http-resp-size": 128, "http-resp-size": 128,
"http-resp-content-type": "text/plain" "http-resp-content-type": "text/plain"
} }

@ -1,160 +1,160 @@
({ {
"active": "no", "active": false,
"name": "adpcm", "name": "adpcm",
"path": "adpcm_wasm.so", "path": "adpcm_wasm.so",
"port": 10000, "port": 10000,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 2 "argsize": 2
}, },
{ {
"active": "yes", "active": true,
"name": "bitcount", "name": "bitcount",
"path": "bitcount_wasm.so", "path": "bitcount_wasm.so",
"port": 10002, "port": 10002,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 2 "argsize": 2
}, },
{ {
"active": "yes", "active": true,
"name": "basic_math", "name": "basic_math",
"path": "basic_math_wasm.so", "path": "basic_math_wasm.so",
"port": 10004, "port": 10004,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 1 "argsize": 1
}, },
{ {
"active": "no", "active": false,
"name": "binarytrees", "name": "binarytrees",
"path": "binarytrees_wasm.so", "path": "binarytrees_wasm.so",
"port": 10006, "port": 10006,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 2 "argsize": 2
}, },
{ {
"active": "no", "active": false,
"name": "crc", "name": "crc",
"path": "crc_wasm.so", "path": "crc_wasm.so",
"port": 10008, "port": 10008,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 2 "argsize": 2
}, },
{ {
"active": "no", "active": false,
"name": "dijkstra", "name": "dijkstra",
"path": "dijkstra_wasm.so", "path": "dijkstra_wasm.so",
"port": 10010, "port": 10010,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 2 "argsize": 2
}, },
{ {
"active": "no", "active": false,
"name": "forever", "name": "forever",
"path": "forever_wasm.so", "path": "forever_wasm.so",
"port": 10012, "port": 10012,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 1 "argsize": 1
}, },
{ {
"active": "no", "active": false,
"name": "fornever", "name": "fornever",
"path": "forever_wasm.so", "path": "forever_wasm.so",
"port": 10014, "port": 10014,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 2 "argsize": 2
}, },
{ {
"active": "no", "active": false,
"name": "fft", "name": "fft",
"path": "fft_wasm.so", "path": "fft_wasm.so",
"port": 10016, "port": 10016,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 3 "argsize": 3
}, },
{ {
"active": "no", "active": false,
"name": "function_pointers", "name": "function_pointers",
"path": "function_pointers_wasm.so", "path": "function_pointers_wasm.so",
"port": 10018, "port": 10018,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 1 "argsize": 1
}, },
{ {
"active": "no", "active": false,
"name": "gsm", "name": "gsm",
"path": "gsm_wasm.so", "path": "gsm_wasm.so",
"port": 10020, "port": 10020,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 4 "argsize": 4
}, },
{ {
"active": "no", "active": false,
"name": "libjpeg", "name": "libjpeg",
"path": "libjpeg_wasm.so", "path": "libjpeg_wasm.so",
"port": 10022, "port": 10022,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 1 "argsize": 1
}, },
{ {
"active": "no", "active": false,
"name": "mandelbrot", "name": "mandelbrot",
"path": "mandelbrot_wasm.so", "path": "mandelbrot_wasm.so",
"port": 10024, "port": 10024,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 2 "argsize": 2
}, },
{ {
"active": "no", "active": false,
"name": "matrix_multiply", "name": "matrix_multiply",
"path": "matrix_multiply_wasm.so", "path": "matrix_multiply_wasm.so",
"port": 10026, "port": 10026,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 1 "argsize": 1
}, },
{ {
"active": "no", "active": false,
"name": "particia", "name": "particia",
"path": "partricia_wasm.so", "path": "partricia_wasm.so",
"port": 10028, "port": 10028,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 2 "argsize": 2
}, },
{ {
"active": "no", "active": false,
"name": "sqlite", "name": "sqlite",
"path": "sqlite_wasm.so", "path": "sqlite_wasm.so",
"port": 10030, "port": 10030,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 1 "argsize": 1
}, },
{ {
"active": "yes", "active": true,
"name": "stringsearch", "name": "stringsearch",
"path": "stringsearch_wasm.so", "path": "stringsearch_wasm.so",
"port": 10032, "port": 10032,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 1 "argsize": 1
}, },
{ {
"active": "no", "active": false,
"name": "filesys", "name": "filesys",
"path": "filesys_wasm.so", "path": "filesys_wasm.so",
"port": 10034, "port": 10034,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 3 "argsize": 3
}, },
{ {
"active": "no", "active": false,
"name": "sockserver", "name": "sockserver",
"path": "sockserver_wasm.so", "path": "sockserver_wasm.so",
"port": 10036, "port": 10036,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 2 "argsize": 2
}, },
{ {
"active": "no", "active": false,
"name": "sockclient", "name": "sockclient",
"path": "sockclient_wasm.so", "path": "sockclient_wasm.so",
"port": 10038, "port": 10038,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 3 "argsize": 3
}) }

@ -1,14 +1,14 @@
{ {
"active": "yes", "active": true,
"name": "lpd", "name": "lpd",
"path": "lpd_wasm.so", "path": "lpd_wasm.so",
"port": 10000, "port": 10000,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 1, "argsize": 1,
"http-req-headers": [], "http-req-headers": [],
"http-req-content-type": "image/jpeg", "http-req-content-type": "image/jpeg",
"http-req-size": 102400, "http-req-size": 102400,
"http-resp-headers": [], "http-resp-headers": [],
"http-resp-size": 1048576, "http-resp-size": 1048576,
"http-resp-content-type": "image/jpeg" "http-resp-content-type": "image/jpeg"
} }

@ -1,14 +1,14 @@
{ {
"active": "yes", "active": true,
"name": "resize", "name": "resize",
"path": "resize_wasm.so", "path": "resize_wasm.so",
"port": 10000, "port": 10000,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 1, "argsize": 1,
"http-req-headers": [], "http-req-headers": [],
"http-req-content-type": "image/jpeg", "http-req-content-type": "image/jpeg",
"http-req-size": 102400, "http-req-size": 102400,
"http-resp-headers": [], "http-resp-headers": [],
"http-resp-size": 102400, "http-resp-size": 102400,
"http-resp-content-type": "image/png" "http-resp-content-type": "image/png"
} }

@ -1,14 +1,14 @@
{ {
"active": "yes", "active": true,
"name": "work", "name": "work",
"path": "work_wasm.so", "path": "work_wasm.so",
"port": 10000, "port": 10000,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 1, "argsize": 1,
"http-req-headers": [], "http-req-headers": [],
"http-req-content-type": "text/plain", "http-req-content-type": "text/plain",
"http-req-size": 1048776, "http-req-size": 1048776,
"http-resp-headers": [], "http-resp-headers": [],
"http-resp-size": 1048776, "http-resp-size": 1048776,
"http-resp-content-type": "text/plain" "http-resp-content-type": "text/plain"
} }

@ -1,14 +1,14 @@
{ {
"active": "yes", "active": true,
"name": "work100k", "name": "work100k",
"path": "work100k_wasm.so", "path": "work100k_wasm.so",
"port": 10000, "port": 10000,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 1, "argsize": 1,
"http-req-headers": [], "http-req-headers": [],
"http-req-content-type": "text/plain", "http-req-content-type": "text/plain",
"http-req-size": 102600, "http-req-size": 102600,
"http-resp-headers": [], "http-resp-headers": [],
"http-resp-size": 102600, "http-resp-size": 102600,
"http-resp-content-type": "text/plain" "http-resp-content-type": "text/plain"
} }

@ -1,14 +1,14 @@
{ {
"active": "yes", "active": true,
"name": "work10k", "name": "work10k",
"path": "work10k_wasm.so", "path": "work10k_wasm.so",
"port": 10000, "port": 10000,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 1, "argsize": 1,
"http-req-headers": [], "http-req-headers": [],
"http-req-content-type": "text/plain", "http-req-content-type": "text/plain",
"http-req-size": 10480, "http-req-size": 10480,
"http-resp-headers": [], "http-resp-headers": [],
"http-resp-size": 10480, "http-resp-size": 10480,
"http-resp-content-type": "text/plain" "http-resp-content-type": "text/plain"
} }

@ -1,14 +1,14 @@
{ {
"active": "yes", "active": true,
"name": "work1k", "name": "work1k",
"path": "work1k_wasm.so", "path": "work1k_wasm.so",
"port": 10000, "port": 10000,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 1, "argsize": 1,
"http-req-headers": [], "http-req-headers": [],
"http-req-content-type": "text/plain", "http-req-content-type": "text/plain",
"http-req-size": 1200, "http-req-size": 1200,
"http-resp-headers": [], "http-resp-headers": [],
"http-resp-size": 1200, "http-resp-size": 1200,
"http-resp-content-type": "text/plain" "http-resp-content-type": "text/plain"
} }

@ -1,14 +1,14 @@
{ {
"active": "yes", "active": true,
"name": "work1m", "name": "work1m",
"path": "work1m_wasm.so", "path": "work1m_wasm.so",
"port": 10000, "port": 10000,
"relative-deadline-us": 50000, "relative-deadline-us": 50000,
"argsize": 1, "argsize": 1,
"http-req-headers": [], "http-req-headers": [],
"http-req-content-type": "text/plain", "http-req-content-type": "text/plain",
"http-req-size": 1048776, "http-req-size": 1048776,
"http-resp-headers": [], "http-resp-headers": [],
"http-resp-size": 1048776, "http-resp-size": 1048776,
"http-resp-content-type": "text/plain" "http-resp-content-type": "text/plain"
} }
Loading…
Cancel
Save