diff --git a/README.md b/README.md index 8c00d1c..c6e0d4b 100644 --- a/README.md +++ b/README.md @@ -86,8 +86,6 @@ An SLEdge serverless function consists of a shared library (\*.so) and a JSON co "port": 10000, "expected-execution-us": 600, "relative-deadline-us": 2000, - "http-req-size": 1024, - "http-resp-size": 1024, "http-resp-content-type": "text/plain" } ``` diff --git a/libsledge/README.md b/libsledge/README.md index 2ea7857..0446256 100644 --- a/libsledge/README.md +++ b/libsledge/README.md @@ -132,8 +132,6 @@ The `sledgert` runtime is invoked with an argument containing the path to a JSON "relative-deadline-us" "expected-execution-us" "admissions-percentile" -"http-req-size" -"http-resp-size" "http-resp-content-type" The path to the JSON file is passed to `module_alloc_from_json`, which uses the Jasmine library to parse the JSON, performs validation, and passes the resulting specification to `module_alloc` for each module definition found. `module_alloc` allocated heap memory for a `struct module` and then calls `module_init`. `module_init` calls `sledge_abi_symbols_init`, which calls `dlopen` on the _.so file at the path specified in the JSON and then calls `dlsym` to resolve symbols within the _.so module. diff --git a/runtime/include/auto_buf.h b/runtime/include/auto_buf.h new file mode 100644 index 0000000..9071d25 --- /dev/null +++ b/runtime/include/auto_buf.h @@ -0,0 +1,43 @@ +#pragma once + +#include +#include +#include + +struct auto_buf { + FILE *handle; + char *data; + size_t size; +}; + +static inline int +auto_buf_init(struct auto_buf *buf) +{ + FILE *res = open_memstream(&buf->data, &buf->size); + if (res == NULL) return errno; + + buf->handle = res; + return 0; +} + +static inline int +auto_buf_flush(struct auto_buf *buf) +{ + return fflush(buf->handle); +} + +static inline void +auto_buf_deinit(struct auto_buf *buf) +{ + if (likely(buf->handle != NULL)) { + fclose(buf->handle); + buf->handle = NULL; + } + + if (likely(buf->data != NULL)) { + free(buf->data); + buf->data = NULL; + } + + buf->size = 0; +} diff --git a/runtime/include/http.h b/runtime/include/http.h index 9d4300f..22af513 100644 --- a/runtime/include/http.h +++ b/runtime/include/http.h @@ -13,57 +13,59 @@ #define HTTP_MAX_QUERY_PARAM_COUNT 16 #define HTTP_MAX_QUERY_PARAM_LENGTH 32 -#define HTTP_RESPONSE_200_TEMPLATE \ - "HTTP/1.1 200 OK\r\n" \ - "Server: SLEdge\r\n" \ - "Connection: close\r\n" \ - "Content-Type: %s\r\n" \ - "Content-Length: %lu\r\n" \ - "\r\n" +#define HTTP_RESPONSE_CONTENT_TYPE "Content-Type: %s\r\n" +#define HTTP_RESPONSE_CONTENT_LENGTH "Content-Length: %lu\r\n" +#define HTTP_RESPONSE_TERMINATOR "\r\n" +#define HTTP_RESPONSE_TERMINATOR_LENGTH 2 -/* The sum of format specifier characters in the template above */ -#define HTTP_RESPONSE_200_TEMPLATE_FORMAT_SPECIFIER_LENGTH 5 +#define HTTP_RESPONSE_200_OK \ + "HTTP/1.1 200 OK\r\n" \ + "Server: SLEdge\r\n" \ + "Connection: close\r\n" +#define HTTP_RESPONSE_200_OK_LENGTH 52 #define HTTP_RESPONSE_400_BAD_REQUEST \ "HTTP/1.1 400 Bad Request\r\n" \ "Server: SLEdge\r\n" \ - "Connection: close\r\n" \ - "\r\n" + "Connection: close\r\n" +#define HTTP_RESPONSE_400_BAD_REQUEST_LENGTH 61 #define HTTP_RESPONSE_404_NOT_FOUND \ "HTTP/1.1 404 Not Found\r\n" \ "Server: SLEdge\r\n" \ - "Connection: close\r\n" \ - "\r\n" + "Connection: close\r\n" +#define HTTP_RESPONSE_404_NOT_FOUND_LENGTH 59 #define HTTP_RESPONSE_413_PAYLOAD_TOO_LARGE \ "HTTP/1.1 413 Payload Too Large\r\n" \ "Server: SLEdge\r\n" \ - "Connection: close\r\n" \ - "\r\n" + "Connection: close\r\n" +#define HTTP_RESPONSE_413_PAYLOAD_TOO_LARGE_LENGTH 67 #define HTTP_RESPONSE_429_TOO_MANY_REQUESTS \ "HTTP/1.1 429 Too Many Requests\r\n" \ "Server: SLEdge\r\n" \ - "Connection: close\r\n" \ - "\r\n" + "Connection: close\r\n" +#define HTTP_RESPONSE_429_TOO_MANY_REQUESTS_LENGTH 67 #define HTTP_RESPONSE_500_INTERNAL_SERVER_ERROR \ "HTTP/1.1 500 Internal Server Error\r\n" \ "Server: SLEdge\r\n" \ - "Connection: close\r\n" \ - "\r\n" + "Connection: close\r\n" +#define HTTP_RESPONSE_500_INTERNAL_SERVER_ERROR_LENGTH 71 #define HTTP_RESPONSE_503_SERVICE_UNAVAILABLE \ "HTTP/1.1 503 Service Unavailable\r\n" \ "Server: SLEdge\r\n" \ - "Connection: close\r\n" \ - "\r\n" + "Connection: close\r\n" +#define HTTP_RESPONSE_503_SERVICE_UNAVAILABLE_LENGTH 69 static inline const char * http_header_build(int status_code) { switch (status_code) { + case 200: + return HTTP_RESPONSE_200_OK; case 400: return HTTP_RESPONSE_400_BAD_REQUEST; case 404: @@ -86,17 +88,17 @@ http_header_len(int status_code) { switch (status_code) { case 400: - return strlen(HTTP_RESPONSE_400_BAD_REQUEST); + return HTTP_RESPONSE_400_BAD_REQUEST_LENGTH; case 404: - return strlen(HTTP_RESPONSE_404_NOT_FOUND); + return HTTP_RESPONSE_404_NOT_FOUND_LENGTH; case 413: - return strlen(HTTP_RESPONSE_413_PAYLOAD_TOO_LARGE); + return HTTP_RESPONSE_413_PAYLOAD_TOO_LARGE_LENGTH; case 429: - return strlen(HTTP_RESPONSE_429_TOO_MANY_REQUESTS); + return HTTP_RESPONSE_429_TOO_MANY_REQUESTS_LENGTH; case 500: - return strlen(HTTP_RESPONSE_500_INTERNAL_SERVER_ERROR); + return HTTP_RESPONSE_500_INTERNAL_SERVER_ERROR_LENGTH; case 503: - return strlen(HTTP_RESPONSE_503_SERVICE_UNAVAILABLE); + return HTTP_RESPONSE_503_SERVICE_UNAVAILABLE_LENGTH; default: panic("%d is not a valid status code\n", status_code); } diff --git a/runtime/include/http_router.h b/runtime/include/http_router.h index 7039525..92554a6 100644 --- a/runtime/include/http_router.h +++ b/runtime/include/http_router.h @@ -34,7 +34,6 @@ http_router_add_route(http_router_t *router, struct route_config *config, struct .relative_deadline_us = config->relative_deadline_us, .relative_deadline = (uint64_t)config->relative_deadline_us * runtime_processor_speed_MHz, - .response_size = config->http_resp_size, .response_content_type = config->http_resp_content_type }; http_route_total_init(&route.metrics); diff --git a/runtime/include/http_session.h b/runtime/include/http_session.h index dccf986..b137a57 100644 --- a/runtime/include/http_session.h +++ b/runtime/include/http_session.h @@ -9,6 +9,7 @@ #include #include +#include "auto_buf.h" #include "debuglog.h" #include "epoll_tag.h" #include "http_parser.h" @@ -20,13 +21,6 @@ #include "route.h" #include "tcp_session.h" #include "tenant.h" -#include "vec.h" - -#define HTTP_SESSION_DEFAULT_REQUEST_RESPONSE_SIZE (PAGE_SIZE) -#define HTTP_SESSION_RESPONSE_HEADER_CAPACITY 256 - -#define u8 uint8_t -VEC(u8) enum http_session_state { @@ -52,12 +46,11 @@ struct http_session { int socket; struct http_parser http_parser; struct http_request http_request; - struct vec_u8 request_buffer; - char response_header[HTTP_SESSION_RESPONSE_HEADER_CAPACITY]; - size_t response_header_length; + struct auto_buf request_buffer; + struct auto_buf response_header; size_t response_header_written; - struct vec_u8 response_buffer; - size_t response_buffer_written; + struct auto_buf response_body; + size_t response_body_written; struct tenant *tenant; /* Backlink required when read blocks on listener core */ struct route *route; /* Backlink required to handle http metrics */ uint64_t request_arrival_timestamp; @@ -104,11 +97,11 @@ http_session_init(struct http_session *session, int socket_descriptor, const str http_session_parser_init(session); - int rc = vec_u8_init(&session->request_buffer, HTTP_SESSION_DEFAULT_REQUEST_RESPONSE_SIZE); + int rc = auto_buf_init(&session->request_buffer); if (rc < 0) return -1; - /* Defer allocating response until we've matched a route */ - session->response_buffer.buffer = NULL; + /* Defer initializing response_body until we've matched a route */ + auto_buf_init(&session->response_header); session->state = HTTP_SESSION_INITIALIZED; @@ -116,14 +109,16 @@ http_session_init(struct http_session *session, int socket_descriptor, const str } static inline int -http_session_init_response_buffer(struct http_session *session, size_t capacity) +http_session_init_response_body(struct http_session *session) { assert(session != NULL); - assert(session->response_buffer.buffer == NULL); + assert(session->response_body.data == NULL); + assert(session->response_body.size == 0); + assert(session->response_body_written == 0); - int rc = vec_u8_init(&session->response_buffer, capacity); + int rc = auto_buf_init(&session->response_body); if (rc < 0) { - vec_u8_deinit(&session->request_buffer); + auto_buf_deinit(&session->request_buffer); return -1; } @@ -158,8 +153,9 @@ http_session_deinit(struct http_session *session) { assert(session); - vec_u8_deinit(&session->request_buffer); - vec_u8_deinit(&session->response_buffer); + auto_buf_deinit(&session->request_buffer); + auto_buf_deinit(&session->response_header); + auto_buf_deinit(&session->response_body); } static inline void @@ -177,8 +173,7 @@ http_session_free(struct http_session *session) * @param status_code */ static inline void -http_session_set_response_header(struct http_session *session, int status_code, const char *content_type, - size_t content_length) +http_session_set_response_header(struct http_session *session, int status_code) { assert(session != NULL); assert(status_code >= 200 && status_code <= 599); @@ -187,20 +182,31 @@ http_session_set_response_header(struct http_session *session, int status_code, /* We might not have actually matched a route */ if (likely(session->route != NULL)) { http_route_total_increment(&session->route->metrics, status_code); } + int rc = fputs(http_header_build(status_code), session->response_header.handle); + assert(rc != EOF); + if (status_code == 200) { - session->response_header_length = snprintf(session->response_header, - HTTP_SESSION_RESPONSE_HEADER_CAPACITY, - HTTP_RESPONSE_200_TEMPLATE, content_type, content_length); - } else { - size_t header_len = http_header_len(status_code); - size_t to_copy = HTTP_SESSION_RESPONSE_HEADER_CAPACITY < header_len - ? HTTP_SESSION_RESPONSE_HEADER_CAPACITY - : header_len; - - strncpy(session->response_header, http_header_build(status_code), to_copy); - session->response_header_length = to_copy; + /* Make sure the response_body is flushed */ + int rc = auto_buf_flush(&session->response_body); + if (unlikely(rc != 0)) { panic("response_body auto_buf failed to flush: %s\n", strerror(errno)); }; + + /* Technically fprintf can truncate, but I assume this won't happen with a memstream */ + rc = fprintf(session->response_header.handle, HTTP_RESPONSE_CONTENT_TYPE, + session->route->response_content_type); + assert(rc > 0); + rc = fprintf(session->response_header.handle, HTTP_RESPONSE_CONTENT_LENGTH, + session->response_body.size); + assert(rc > 0); + rc = fputs(HTTP_RESPONSE_200_OK, session->response_header.handle); + assert(rc != EOF); } + rc = fputs(HTTP_RESPONSE_TERMINATOR, session->response_header.handle); + assert(rc != EOF); + + rc = auto_buf_flush(&session->response_header); + if (unlikely(rc != 0)) { panic("response_header auto_buf failed to flush: %s\n", strerror(errno)); }; + session->response_takeoff_timestamp = __getcycles(); } @@ -226,11 +232,11 @@ http_session_send_response_header(struct http_session *session, void_star_cb on_ || session->state == HTTP_SESSION_SEND_RESPONSE_HEADER_BLOCKED); session->state = HTTP_SESSION_SENDING_RESPONSE_HEADER; - while (session->response_header_length > session->response_header_written) { + while (session->response_header.size > session->response_header_written) { ssize_t sent = tcp_session_send(session->socket, - (const char *)&session->response_header[session->response_header_written], - session->response_header_length - session->response_header_written, on_eagain, + (const char *)&session->response_header.data[session->response_header_written], + session->response_header.size - session->response_header_written, on_eagain, session); if (sent < 0) { return (int)sent; @@ -259,16 +265,18 @@ http_session_send_response_body(struct http_session *session, void_star_cb on_ea || session->state == HTTP_SESSION_SEND_RESPONSE_BODY_BLOCKED); session->state = HTTP_SESSION_SENDING_RESPONSE_BODY; - while (session->response_buffer_written < session->response_buffer.length) { + /* Assumption: Already flushed in order to write content-length to header */ + // TODO: Test if body is empty + + while (session->response_body_written < session->response_body.size) { ssize_t sent = tcp_session_send(session->socket, - (const char *)&session->response_buffer.buffer[session->response_buffer_written], - session->response_buffer.length - session->response_buffer_written, on_eagain, - session); + (const char *)&session->response_body.data[session->response_body_written], + session->response_body.size - session->response_body_written, on_eagain, session); if (sent < 0) { return (int)sent; } else { - session->response_buffer_written += (size_t)sent; + session->response_body_written += (size_t)sent; } } @@ -276,45 +284,6 @@ http_session_send_response_body(struct http_session *session, void_star_cb on_ea return 0; } -static inline bool -http_session_request_buffer_is_full(struct http_session *session) -{ - return session->request_buffer.length == session->request_buffer.capacity; -} - -static inline int -http_session_request_buffer_grow(struct http_session *session) -{ - /* We have not yet fully parsed the header, so we don't know content-length, so just grow - * (double) the buffer */ - uint8_t *old_buffer = session->request_buffer.buffer; - - if (vec_u8_grow(&session->request_buffer) != 0) { - debuglog("Failed to grow request buffer\n"); - return -1; - } - - /* buffer moved, so invalidate to reparse */ - if (old_buffer != session->request_buffer.buffer) { http_session_parser_init(session); } - - return 0; -} - -static inline int -http_session_request_buffer_resize(struct http_session *session, int required_size) -{ - uint8_t *old_buffer = session->request_buffer.buffer; - if (vec_u8_resize(&session->request_buffer, required_size) != 0) { - debuglog("Failed to resize request vector to %d bytes\n", required_size); - return -1; - } - - /* buffer moved, so invalidate to reparse */ - if (old_buffer != session->request_buffer.buffer) { http_session_parser_init(session); } - - return 0; -} - typedef void (*http_session_cb)(struct http_session *); static inline ssize_t @@ -331,8 +300,8 @@ http_session_parse(struct http_session *session, ssize_t bytes_received) #endif size_t bytes_parsed = http_parser_execute(&session->http_parser, settings, - (const char *)&session->request_buffer.buffer[session->http_request.length_parsed], - (size_t)session->request_buffer.length - session->http_request.length_parsed); + (const char *)&session->request_buffer.data[session->http_request.length_parsed], + (size_t)session->request_buffer.size - session->http_request.length_parsed); if (session->http_parser.http_errno != HPE_OK) { debuglog("Error: %s, Description: %s\n", @@ -382,52 +351,46 @@ static inline int http_session_receive_request(struct http_session *session, void_star_cb on_eagain) { assert(session != NULL); - assert(session->request_buffer.capacity > 0); - assert(session->request_buffer.length <= session->request_buffer.capacity); + assert(session->request_buffer.handle != NULL); assert(session->state == HTTP_SESSION_INITIALIZED || session->state == HTTP_SESSION_RECEIVE_REQUEST_BLOCKED); session->state = HTTP_SESSION_RECEIVING_REQUEST; - int rc = 0; - - while (!session->http_request.message_end) { - /* If we know the header size and content-length, resize exactly. Otherwise double */ - if (session->http_request.header_end && session->http_request.body) { - int header_size = (uint8_t *)session->http_request.body - session->request_buffer.buffer; - int required_size = header_size + session->http_request.body_length; - - if (required_size > session->request_buffer.capacity) { - rc = http_session_request_buffer_resize(session, required_size); - if (rc != 0) goto err_nobufs; - } - } else if (http_session_request_buffer_is_full(session)) { - rc = http_session_request_buffer_grow(session); - if (rc != 0) goto err_nobufs; - } + struct http_request *http_request = &session->http_request; + int rc = 0; + char temp[BUFSIZ]; - ssize_t bytes_received = - tcp_session_recv(session->socket, - (char *)&session->request_buffer.buffer[session->request_buffer.length], - session->request_buffer.capacity - session->request_buffer.length, on_eagain, - session); + while (!http_request->message_end) { + ssize_t bytes_received = tcp_session_recv(session->socket, temp, BUFSIZ, on_eagain, session); if (unlikely(bytes_received == -EAGAIN)) goto err_eagain; else if (unlikely(bytes_received < 0)) goto err; /* If we received an EOF before we were able to parse a complete HTTP message, request is malformed */ - else if (unlikely(bytes_received == 0 && !session->http_request.message_end)) + else if (unlikely(bytes_received == 0 && !http_request->message_end)) goto err; assert(bytes_received > 0); - assert(session->request_buffer.length < session->request_buffer.capacity); - session->request_buffer.length += bytes_received; + const char *old_buffer = session->request_buffer.data; + const ssize_t header_length = session->request_buffer.size - http_request->body_length_read; + assert(!http_request->header_end || header_length > 0); + + /* Write temp buffer to memstream */ + fwrite(temp, 1, bytes_received, session->request_buffer.handle); + + /* fflush memstream managed buffer */ + fflush(session->request_buffer.handle); - ssize_t bytes_parsed = http_session_parse(session, bytes_received); - if (bytes_parsed == -1) goto err; + /* Update parser structure if buffer moved */ + if (old_buffer != session->request_buffer.data) { + http_request->body = header_length ? session->request_buffer.data + header_length : NULL; + } + + if (http_session_parse(session, bytes_received) == -1) goto err; } - assert(session->http_request.message_end == true); + assert(http_request->message_end == true); session->state = HTTP_SESSION_RECEIVED_REQUEST; http_session_log_query_params(session); @@ -456,26 +419,10 @@ static inline int http_session_write_response(struct http_session *session, const uint8_t *source, size_t n) { assert(session); - assert(session->response_buffer.buffer != NULL); + assert(session->response_body.handle != NULL); assert(source); - int rc = 0; - - size_t buffer_remaining = session->response_buffer.capacity - session->response_buffer.length; - - if (buffer_remaining < n) { - rc = vec_u8_resize(&session->response_buffer, session->response_buffer.capacity + n - buffer_remaining); - if (rc != 0) goto DONE; - } - - assert(session->response_buffer.capacity - session->response_buffer.length >= n); - - memcpy(&session->response_buffer.buffer[session->response_buffer.length], source, n); - session->response_buffer.length += n; - rc = n; - -DONE: - return rc; + return fwrite(source, 1, n, session->response_body.handle); } static inline void diff --git a/runtime/include/route.h b/runtime/include/route.h index 853c44f..6854b93 100644 --- a/runtime/include/route.h +++ b/runtime/include/route.h @@ -15,7 +15,6 @@ struct route { /* HTTP State */ uint32_t relative_deadline_us; uint64_t relative_deadline; /* cycles */ - size_t response_size; char *response_content_type; struct admissions_info admissions_info; }; diff --git a/runtime/include/route_config.h b/runtime/include/route_config.h index a7ad950..78b743b 100644 --- a/runtime/include/route_config.h +++ b/runtime/include/route_config.h @@ -15,7 +15,6 @@ enum route_config_member route_config_member_admissions_percentile, route_config_member_expected_execution_us, route_config_member_relative_deadline_us, - route_config_member_http_resp_size, route_config_member_http_resp_content_type, route_config_member_len }; @@ -26,7 +25,6 @@ struct route_config { uint8_t admissions_percentile; uint32_t expected_execution_us; uint32_t relative_deadline_us; - uint32_t http_resp_size; char *http_resp_content_type; }; @@ -49,7 +47,6 @@ route_config_print(struct route_config *config) printf("[Route] Admissions Percentile: %hhu\n", config->admissions_percentile); printf("[Route] Expected Execution (us): %u\n", config->expected_execution_us); printf("[Route] Relative Deadline (us): %u\n", config->relative_deadline_us); - printf("[Route] HTTP Response Size: %u\n", config->http_resp_size); printf("[Route] HTTP Response Content Type: %s\n", config->http_resp_content_type); } diff --git a/runtime/include/route_config_parse.h b/runtime/include/route_config_parse.h index 653e9e7..f3a1be0 100644 --- a/runtime/include/route_config_parse.h +++ b/runtime/include/route_config_parse.h @@ -11,7 +11,6 @@ static const char *route_config_json_keys[route_config_member_len] = { "route", "admissions-percentile", "expected-execution-us", "relative-deadline-us", - "http-resp-size", "http-resp-content-type" }; static inline int @@ -89,14 +88,6 @@ route_config_parse(struct route_config *config, const char *json_buf, jsmntok_t route_config_json_keys[route_config_member_relative_deadline_us], &config->relative_deadline_us); if (rc < 0) return -1; - } else if (strcmp(key, route_config_json_keys[route_config_member_http_resp_size]) == 0) { - if (!has_valid_type(tokens[i], key, JSMN_PRIMITIVE, json_buf)) return -1; - if (route_config_set_key_once(did_set, route_config_member_http_resp_size) == -1) return -1; - - int rc = parse_uint32_t(tokens[i], json_buf, - route_config_json_keys[route_config_member_http_resp_size], - &config->http_resp_size); - if (rc < 0) return -1; } else if (strcmp(key, route_config_json_keys[route_config_member_http_resp_content_type]) == 0) { if (!is_nonempty_string(tokens[i], key)) return -1; if (route_config_set_key_once(did_set, route_config_member_http_resp_content_type) == -1) diff --git a/runtime/include/sandbox_set_as_error.h b/runtime/include/sandbox_set_as_error.h index 2f259d1..39020ed 100644 --- a/runtime/include/sandbox_set_as_error.h +++ b/runtime/include/sandbox_set_as_error.h @@ -58,7 +58,7 @@ sandbox_set_as_error(struct sandbox *sandbox, sandbox_state_t last_state) admissions_control_subtract(sandbox->admissions_estimate); /* Return HTTP session to listener core to be written back to client */ - http_session_set_response_header(sandbox->http, 500, NULL, 0); + http_session_set_response_header(sandbox->http, 500); sandbox->http->state = HTTP_SESSION_EXECUTION_COMPLETE; http_session_send_response(sandbox->http, (void_star_cb)listener_thread_register_http_session); sandbox->http = NULL; diff --git a/runtime/include/sandbox_set_as_returned.h b/runtime/include/sandbox_set_as_returned.h index 6f7c3ee..2eec1bf 100644 --- a/runtime/include/sandbox_set_as_returned.h +++ b/runtime/include/sandbox_set_as_returned.h @@ -3,6 +3,7 @@ #include #include +#include "auto_buf.h" #include "arch/getcycles.h" #include "listener_thread.h" #include "local_runqueue.h" @@ -50,8 +51,7 @@ sandbox_set_as_returned(struct sandbox *sandbox, sandbox_state_t last_state) sandbox_state_totals_increment(SANDBOX_RETURNED); sandbox_state_totals_decrement(last_state); - http_session_set_response_header(sandbox->http, 200, sandbox->route->response_content_type, - sandbox->http->response_buffer.length); + http_session_set_response_header(sandbox->http, 200); sandbox->http->state = HTTP_SESSION_EXECUTION_COMPLETE; http_session_send_response(sandbox->http, (void_star_cb)listener_thread_register_http_session); sandbox->http = NULL; diff --git a/runtime/src/http_session_perf_log.c b/runtime/src/http_session_perf_log.c index 4c67672..cbc4155 100644 --- a/runtime/src/http_session_perf_log.c +++ b/runtime/src/http_session_perf_log.c @@ -20,6 +20,6 @@ http_session_perf_log_print_entry(struct http_session *http_session) fprintf(http_session_perf_log, "%s,%s,%u,%lu,%lu,%lu,%lu,%lu,%u\n", http_session->tenant->name, http_session->http_request.full_url, http_session->state, http_session->response_header_written, - http_session->response_buffer_written, receive_duration, sent_duration, total_lifetime, + http_session->response_body_written, receive_duration, sent_duration, total_lifetime, runtime_processor_speed_MHz); } diff --git a/runtime/src/libc/wasi_impl_serverless.c b/runtime/src/libc/wasi_impl_serverless.c index 32063b6..d53af20 100644 --- a/runtime/src/libc/wasi_impl_serverless.c +++ b/runtime/src/libc/wasi_impl_serverless.c @@ -786,23 +786,9 @@ wasi_snapshot_preview1_backing_fd_write(wasi_context_t *context, __wasi_fd_t fd, size_t iovs_len, __wasi_size_t *nwritten_retptr) { if (fd == STDOUT_FILENO || fd == STDERR_FILENO) { - struct sandbox *s = current_sandbox_get(); - size_t buffer_remaining = 0; - __wasi_size_t nwritten = 0; - int rc = 0; - - /* Precompute required buffer size for entire iovec to call realloc at most once */ - size_t total_size_to_copy = 0; - for (size_t i = 0; i < iovs_len; i++) { total_size_to_copy += iovs[i].buf_len; } - buffer_remaining = s->http->response_buffer.capacity - s->http->response_buffer.length; - - if (buffer_remaining < total_size_to_copy) { - rc = vec_u8_resize(&s->http->response_buffer, - s->http->response_buffer.capacity + total_size_to_copy - buffer_remaining); - assert(rc == 0); - } - - assert(s->http->response_buffer.capacity - s->http->response_buffer.length >= total_size_to_copy); + struct sandbox *s = current_sandbox_get(); + __wasi_size_t nwritten = 0; + int rc = 0; for (size_t i = 0; i < iovs_len; i++) { #ifdef LOG_SANDBOX_STDERR @@ -810,8 +796,8 @@ wasi_snapshot_preview1_backing_fd_write(wasi_context_t *context, __wasi_fd_t fd, debuglog("STDERR from Sandbox: %.*s", iovs[i].buf_len, iovs[i].buf); } #endif - rc = http_session_write_response(s->http, iovs[i].buf, iovs[i].buf_len); - if (rc < 0) return __WASI_ERRNO_FBIG; + rc = fwrite(iovs[i].buf, 1, iovs[i].buf_len, s->http->response_body.handle); + if (rc != iovs[i].buf_len) return __WASI_ERRNO_FBIG; nwritten += rc; } diff --git a/runtime/src/listener_thread.c b/runtime/src/listener_thread.c index d075611..31d8e4b 100644 --- a/runtime/src/listener_thread.c +++ b/runtime/src/listener_thread.c @@ -182,7 +182,7 @@ on_client_request_arrival(int client_socket, const struct sockaddr *client_addre /* Failed to allocate memory */ debuglog("Failed to allocate http session\n"); session->state = HTTP_SESSION_EXECUTION_COMPLETE; - http_session_set_response_header(session, 500, NULL, 0); + http_session_set_response_header(session, 500); on_client_response_header_sending(session); return; } @@ -203,13 +203,13 @@ on_client_request_receiving(struct http_session *session) /* Failed to grow request buffer */ debuglog("Failed to grow http request buffer\n"); session->state = HTTP_SESSION_EXECUTION_COMPLETE; - http_session_set_response_header(session, 500, NULL, 0); + http_session_set_response_header(session, 500); on_client_response_header_sending(session); return; } else if (rc < 0) { debuglog("Failed to receive or parse request\n"); session->state = HTTP_SESSION_EXECUTION_COMPLETE; - http_session_set_response_header(session, 400, NULL, 0); + http_session_set_response_header(session, 400); on_client_response_header_sending(session); return; } @@ -227,7 +227,7 @@ on_client_request_received(struct http_session *session) if (route == NULL) { debuglog("Did not match any routes\n"); session->state = HTTP_SESSION_EXECUTION_COMPLETE; - http_session_set_response_header(session, 404, NULL, 0); + http_session_set_response_header(session, 404); on_client_response_header_sending(session); return; } @@ -242,7 +242,7 @@ on_client_request_received(struct http_session *session) uint64_t work_admitted = admissions_control_decide(route->admissions_info.estimate); if (work_admitted == 0) { session->state = HTTP_SESSION_EXECUTION_COMPLETE; - http_session_set_response_header(session, 429, NULL, 0); + http_session_set_response_header(session, 429); on_client_response_header_sending(session); return; } @@ -253,7 +253,7 @@ on_client_request_received(struct http_session *session) if (unlikely(sandbox == NULL)) { debuglog("Failed to allocate sandbox\n"); session->state = HTTP_SESSION_EXECUTION_COMPLETE; - http_session_set_response_header(session, 500, NULL, 0); + http_session_set_response_header(session, 500); on_client_response_header_sending(session); return; } @@ -263,7 +263,7 @@ on_client_request_received(struct http_session *session) debuglog("Failed to add sandbox to global queue\n"); sandbox_free(sandbox); session->state = HTTP_SESSION_EXECUTION_COMPLETE; - http_session_set_response_header(session, 429, NULL, 0); + http_session_set_response_header(session, 429); on_client_response_header_sending(session); } } diff --git a/runtime/src/metrics_server.c b/runtime/src/metrics_server.c index e554a53..f7ac786 100644 --- a/runtime/src/metrics_server.c +++ b/runtime/src/metrics_server.c @@ -60,6 +60,7 @@ metrics_server_thread_spawn(int client_socket) if (strncmp(http_status_code_buf, "GET /metrics HTTP", 10) != 0) { write(client_socket, http_header_build(404), http_header_len(404)); + write(client_socket, HTTP_RESPONSE_TERMINATOR, HTTP_RESPONSE_TERMINATOR_LENGTH); close(client_socket); return; } @@ -122,7 +123,7 @@ metrics_server_handler(void *arg) proc_stat_metrics_init(&stat); #endif - fprintf(ostream, "HTTP/1.1 200 OK\r\n\r\n"); + fprintf(ostream, HTTP_RESPONSE_200_OK HTTP_RESPONSE_TERMINATOR); #ifdef PROC_STAT_METRICS fprintf(ostream, "# TYPE os_proc_major_page_faults counter\n"); diff --git a/runtime/src/sandbox.c b/runtime/src/sandbox.c index 384777b..1acab59 100644 --- a/runtime/src/sandbox.c +++ b/runtime/src/sandbox.c @@ -94,9 +94,9 @@ sandbox_prepare_execution_environment(struct sandbox *sandbox) int rc; - rc = http_session_init_response_buffer(sandbox->http, sandbox->route->response_size); + rc = http_session_init_response_body(sandbox->http); if (rc < 0) { - error_message = "failed to allocate response buffer"; + error_message = "failed to allocate response body"; goto err_globals_allocation_failed; } diff --git a/tests/CMSIS_5_NN/imageclassification/spec.json b/tests/CMSIS_5_NN/imageclassification/spec.json index 7bb6b2d..4162968 100644 --- a/tests/CMSIS_5_NN/imageclassification/spec.json +++ b/tests/CMSIS_5_NN/imageclassification/spec.json @@ -10,7 +10,6 @@ "path": "cifar10.wasm.so", "expected-execution-us": 5000, "relative-deadline-us": 50000, - "http-resp-size": 128, "http-resp-content-type": "text/plain" }, { @@ -18,7 +17,6 @@ "path": "cifar10.wasm.so", "expected-execution-us": 5000, "relative-deadline-us": 50000, - "http-resp-size": 128, "http-resp-content-type": "text/plain" } ] diff --git a/tests/TinyEKF/by_iteration/spec.json b/tests/TinyEKF/by_iteration/spec.json index 4955fb4..0908723 100644 --- a/tests/TinyEKF/by_iteration/spec.json +++ b/tests/TinyEKF/by_iteration/spec.json @@ -10,7 +10,6 @@ "path": "gps_ekf.wasm.so", "expected-execution-us": 5000, "relative-deadline-us": 50000, - "http-resp-size": 1024000, "http-resp-content-type": "application/octet-stream" }, { @@ -18,7 +17,6 @@ "path": "gps_ekf.wasm.so", "expected-execution-us": 5000, "relative-deadline-us": 50000, - "http-resp-size": 1024000, "http-resp-content-type": "application/octet-stream" }, { @@ -26,7 +24,6 @@ "path": "gps_ekf.wasm.so", "expected-execution-us": 5000, "relative-deadline-us": 50000, - "http-resp-size": 1024000, "http-resp-content-type": "application/octet-stream" } ] diff --git a/tests/TinyEKF/one_iteration/spec.json b/tests/TinyEKF/one_iteration/spec.json index f4f6773..4530a41 100644 --- a/tests/TinyEKF/one_iteration/spec.json +++ b/tests/TinyEKF/one_iteration/spec.json @@ -10,7 +10,6 @@ "path": "gps_ekf.wasm.so", "expected-execution-us": 5000, "relative-deadline-us": 50000, - "http-resp-size": 1024000, "http-resp-content-type": "application/octet-stream" } ] diff --git a/tests/cmu-sod/spec.json b/tests/cmu-sod/spec.json index 253a3d6..146edbe 100644 --- a/tests/cmu-sod/spec.json +++ b/tests/cmu-sod/spec.json @@ -10,7 +10,6 @@ "path": "depth_to_xyz.wasm.so", "expected-execution-us": 5000, "relative-deadline-us": 360000, - "http-resp-size": 5335057, "http-resp-content-type": "img/png" } ] diff --git a/tests/deadline_description/cifar10/template.json b/tests/deadline_description/cifar10/template.json index 66caa3f..03fc901 100644 --- a/tests/deadline_description/cifar10/template.json +++ b/tests/deadline_description/cifar10/template.json @@ -5,6 +5,5 @@ "expected-execution-us": 5000, "relative-deadline-us": 50000, "http-req-size": 4096, - "http-resp-size": 128, "http-resp-content-type": "text/plain" } diff --git a/tests/deadline_description/ekf/template.json b/tests/deadline_description/ekf/template.json index a9bab5e..7fac038 100644 --- a/tests/deadline_description/ekf/template.json +++ b/tests/deadline_description/ekf/template.json @@ -5,6 +5,5 @@ "expected-execution-us": 5000, "relative-deadline-us": 50000, "http-req-size": 1024000, - "http-resp-size": 1024000, "http-resp-content-type": "application/octet-stream" } diff --git a/tests/deadline_description/gocr/template.json b/tests/deadline_description/gocr/template.json index 59f6649..0786c27 100644 --- a/tests/deadline_description/gocr/template.json +++ b/tests/deadline_description/gocr/template.json @@ -5,6 +5,5 @@ "expected-execution-us": 5000, "relative-deadline-us": 360000, "http-req-size": 5335057, - "http-resp-size": 5335057, "http-resp-content-type": "text/plain" } diff --git a/tests/deadline_description/lpd/template.json b/tests/deadline_description/lpd/template.json index e0e1afd..214b854 100644 --- a/tests/deadline_description/lpd/template.json +++ b/tests/deadline_description/lpd/template.json @@ -5,6 +5,5 @@ "expected-execution-us": 5000, "relative-deadline-us": 50000, "http-req-size": 1002400, - "http-resp-size": 1048576, "http-resp-content-type": "text/plain" } diff --git a/tests/deadline_description/resize/template.json b/tests/deadline_description/resize/template.json index 8f63222..1ecd826 100644 --- a/tests/deadline_description/resize/template.json +++ b/tests/deadline_description/resize/template.json @@ -5,6 +5,5 @@ "expected-execution-us": 5000, "relative-deadline-us": 50000, "http-req-size": 1524000, - "http-resp-size": 1524000, "http-resp-content-type": "image/png" } diff --git a/tests/deadline_description/spec.json b/tests/deadline_description/spec.json index 73c7785..8af5c4b 100644 --- a/tests/deadline_description/spec.json +++ b/tests/deadline_description/spec.json @@ -10,7 +10,6 @@ "path": "gps_ekf.wasm.so", "expected-execution-us": 5000, "relative-deadline-us": 50000, - "http-resp-size": 1024000, "http-resp-content-type": "application/octet-stream" }, { @@ -18,7 +17,6 @@ "path": "resize_image.wasm.so", "expected-execution-us": 5000, "relative-deadline-us": 50000, - "http-resp-size": 1024000, "http-resp-content-type": "image/png" }, { @@ -26,7 +24,6 @@ "path": "license_plate_detection.wasm.so", "expected-execution-us": 5000, "relative-deadline-us": 50000, - "http-resp-size": 1048576, "http-resp-content-type": "text/plain" }, { @@ -34,7 +31,6 @@ "path": "gocr.wasm.so", "expected-execution-us": 5000, "relative-deadline-us": 360000, - "http-resp-size": 5335057, "http-resp-content-type": "text/plain" }, { @@ -42,7 +38,6 @@ "path": "cifar10.wasm.so", "expected-execution-us": 5000, "relative-deadline-us": 50000, - "http-resp-size": 128, "http-resp-content-type": "text/plain" } ] diff --git a/tests/empty/concurrency/spec.json b/tests/empty/concurrency/spec.json index 5383bde..d0d98e5 100644 --- a/tests/empty/concurrency/spec.json +++ b/tests/empty/concurrency/spec.json @@ -11,7 +11,6 @@ "expected-execution-us": 500, "admissions-percentile": 70, "relative-deadline-us": 50000, - "http-resp-size": 0, "http-resp-content-type": "text/plain" } ] diff --git a/tests/fibonacci/bimodal/spec.json b/tests/fibonacci/bimodal/spec.json index bc49a1d..10f0e1e 100644 --- a/tests/fibonacci/bimodal/spec.json +++ b/tests/fibonacci/bimodal/spec.json @@ -11,7 +11,6 @@ "admissions-percentile": 70, "expected-execution-us": 6000, "relative-deadline-us": 20000, - "http-resp-size": 1024, "http-resp-content-type": "text/plain" }, { @@ -20,7 +19,6 @@ "expected-execution-us": 10000000, "admissions-percentile": 70, "relative-deadline-us": 20000000, - "http-resp-size": 1024, "http-resp-content-type": "text/plain" } ] @@ -37,7 +35,6 @@ "admissions-percentile": 70, "expected-execution-us": 6000, "relative-deadline-us": 20000, - "http-resp-size": 1024, "http-resp-content-type": "text/plain" } ] diff --git a/tests/fibonacci/concurrency/spec.json b/tests/fibonacci/concurrency/spec.json index 72f39fe..ae79b08 100644 --- a/tests/fibonacci/concurrency/spec.json +++ b/tests/fibonacci/concurrency/spec.json @@ -11,7 +11,6 @@ "admissions-percentile": 70, "expected-execution-us": 4000, "relative-deadline-us": 16000, - "http-resp-size": 1024, "http-resp-content-type": "text/plain" } ] diff --git a/tests/gocr/by_dpi/spec.json b/tests/gocr/by_dpi/spec.json index 0adeb39..7cafb50 100644 --- a/tests/gocr/by_dpi/spec.json +++ b/tests/gocr/by_dpi/spec.json @@ -10,7 +10,6 @@ "path": "gocr.wasm.so", "expected-execution-us": 5000, "relative-deadline-us": 36000, - "http-resp-size": 5335057, "http-resp-content-type": "text/plain" }, { @@ -18,7 +17,6 @@ "path": "gocr.wasm.so", "expected-execution-us": 5000, "relative-deadline-us": 36000, - "http-resp-size": 5335057, "http-resp-content-type": "text/plain" }, { @@ -26,7 +24,6 @@ "path": "gocr.wasm.so", "expected-execution-us": 5000, "relative-deadline-us": 36000, - "http-resp-size": 5335057, "http-resp-content-type": "text/plain" } ] diff --git a/tests/gocr/by_font/spec.json b/tests/gocr/by_font/spec.json index 85dac11..89b3f56 100644 --- a/tests/gocr/by_font/spec.json +++ b/tests/gocr/by_font/spec.json @@ -10,7 +10,6 @@ "path": "gocr.wasm.so", "expected-execution-us": 5000, "relative-deadline-us": 36000, - "http-resp-size": 5335057, "http-resp-content-type": "text/plain" }, { @@ -18,7 +17,6 @@ "path": "gocr.wasm.so", "expected-execution-us": 5000, "relative-deadline-us": 36000, - "http-resp-size": 5335057, "http-resp-content-type": "text/plain" }, { @@ -26,7 +24,6 @@ "path": "gocr.wasm.so", "expected-execution-us": 5000, "relative-deadline-us": 36000, - "http-resp-size": 5335057, "http-resp-content-type": "text/plain" } ] diff --git a/tests/gocr/by_word/spec.json b/tests/gocr/by_word/spec.json index a9c5622..4089777 100644 --- a/tests/gocr/by_word/spec.json +++ b/tests/gocr/by_word/spec.json @@ -10,7 +10,6 @@ "path": "gocr.wasm.so", "expected-execution-us": 5000, "relative-deadline-us": 36000, - "http-resp-size": 5335057, "http-resp-content-type": "text/plain" }, { @@ -18,7 +17,6 @@ "path": "gocr.wasm.so", "expected-execution-us": 5000, "relative-deadline-us": 36000, - "http-resp-size": 5335057, "http-resp-content-type": "text/plain" }, { @@ -26,7 +24,6 @@ "path": "gocr.wasm.so", "expected-execution-us": 5000, "relative-deadline-us": 36000, - "http-resp-size": 5335057, "http-resp-content-type": "text/plain" } ] diff --git a/tests/gocr/fivebyeight/spec.json b/tests/gocr/fivebyeight/spec.json index c18d0c4..492325a 100644 --- a/tests/gocr/fivebyeight/spec.json +++ b/tests/gocr/fivebyeight/spec.json @@ -10,7 +10,6 @@ "path": "gocr.wasm.so", "expected-execution-us": 5000, "relative-deadline-us": 36000, - "http-resp-size": 1024000, "http-resp-content-type": "text/plain" } ] diff --git a/tests/gocr/handwriting/spec.json b/tests/gocr/handwriting/spec.json index c18d0c4..492325a 100644 --- a/tests/gocr/handwriting/spec.json +++ b/tests/gocr/handwriting/spec.json @@ -10,7 +10,6 @@ "path": "gocr.wasm.so", "expected-execution-us": 5000, "relative-deadline-us": 36000, - "http-resp-size": 1024000, "http-resp-content-type": "text/plain" } ] diff --git a/tests/gocr/hyde/spec.json b/tests/gocr/hyde/spec.json index f814f6d..a3ee5b3 100644 --- a/tests/gocr/hyde/spec.json +++ b/tests/gocr/hyde/spec.json @@ -10,7 +10,6 @@ "path": "gocr.wasm.so", "expected-execution-us": 5000, "relative-deadline-us": 360000, - "http-resp-size": 5335057, "http-resp-content-type": "text/plain" } ] diff --git a/tests/html/spec.json b/tests/html/spec.json index 5ab14c1..456ee45 100644 --- a/tests/html/spec.json +++ b/tests/html/spec.json @@ -11,7 +11,6 @@ "expected-execution-us": 10000000, "admissions-percentile": 70, "relative-deadline-us": 20000000, - "http-resp-size": 102400, "http-resp-content-type": "text/html" } ] diff --git a/tests/mt_unimodal/spec.json b/tests/mt_unimodal/spec.json index 95d8a8e..62f433c 100644 --- a/tests/mt_unimodal/spec.json +++ b/tests/mt_unimodal/spec.json @@ -1,36 +1,34 @@ [ - { - "name": "GWU", - "port": 20030, - "replenishment-period-us": 16000, - "max-budget-us": 144000, - "routes": [ - { - "route": "/fib", - "path": "fibonacci.wasm.so", - "admissions-percentile": 70, - "expected-execution-us": 4000, - "relative-deadline-us": 16000, - "http-resp-size": 1024, - "http-resp-content-type": "text/plain" - } - ] - }, - { - "name": "NNN", - "port": 10030, - "replenishment-period-us": 0, - "max-budget-us": 0, - "routes": [ - { - "route": "/fib", - "path": "fibonacci.wasm.so", - "admissions-percentile": 70, - "expected-execution-us": 4000, - "relative-deadline-us": 16000, - "http-resp-size": 1024, - "http-resp-content-type": "text/plain" - } - ] - } + { + "name": "GWU", + "port": 20030, + "replenishment-period-us": 16000, + "max-budget-us": 144000, + "routes": [ + { + "route": "/fib", + "path": "fibonacci.wasm.so", + "admissions-percentile": 70, + "expected-execution-us": 4000, + "relative-deadline-us": 16000, + "http-resp-content-type": "text/plain" + } + ] + }, + { + "name": "NNN", + "port": 10030, + "replenishment-period-us": 0, + "max-budget-us": 0, + "routes": [ + { + "route": "/fib", + "path": "fibonacci.wasm.so", + "admissions-percentile": 70, + "expected-execution-us": 4000, + "relative-deadline-us": 16000, + "http-resp-content-type": "text/plain" + } + ] + } ] diff --git a/tests/mt_unimodal/template.json b/tests/mt_unimodal/template.json index e5e2a81..696dbd2 100644 --- a/tests/mt_unimodal/template.json +++ b/tests/mt_unimodal/template.json @@ -10,7 +10,6 @@ "admissions-percentile": 0, "expected-execution-us": 0, "relative-deadline-us": 0, - "http-resp-size": 1024, "http-resp-content-type": "text/plain" } ] diff --git a/tests/scratch_storage/spec.json b/tests/scratch_storage/spec.json index 12f3e3f..b369d63 100644 --- a/tests/scratch_storage/spec.json +++ b/tests/scratch_storage/spec.json @@ -11,8 +11,7 @@ "expected-execution-us": 10000000, "admissions-percentile": 70, "relative-deadline-us": 20000000, - "http-resp-content-type": "text/plain", - "http-resp-size": 1024 + "http-resp-content-type": "text/plain" }, { "route": "/get", @@ -20,8 +19,7 @@ "expected-execution-us": 10000000, "admissions-percentile": 70, "relative-deadline-us": 20000000, - "http-resp-content-type": "text/plain", - "http-resp-size": 1024 + "http-resp-content-type": "text/plain" }, { "route": "/delete", @@ -29,8 +27,7 @@ "expected-execution-us": 10000000, "admissions-percentile": 70, "relative-deadline-us": 20000000, - "http-resp-content-type": "text/plain", - "http-resp-size": 1024 + "http-resp-content-type": "text/plain" }, { "route": "/upsert", @@ -38,8 +35,7 @@ "expected-execution-us": 10000000, "admissions-percentile": 70, "relative-deadline-us": 20000000, - "http-resp-content-type": "text/plain", - "http-resp-size": 1024 + "http-resp-content-type": "text/plain" } ] } diff --git a/tests/sod/image_resize/by_resolution/spec.json b/tests/sod/image_resize/by_resolution/spec.json index 909979b..f185925 100644 --- a/tests/sod/image_resize/by_resolution/spec.json +++ b/tests/sod/image_resize/by_resolution/spec.json @@ -10,7 +10,6 @@ "path": "resize_image.wasm.so", "expected-execution-us": 5000, "relative-deadline-us": 50000, - "http-resp-size": 1024000, "http-resp-content-type": "image/png" }, { @@ -18,7 +17,6 @@ "path": "resize_image.wasm.so", "expected-execution-us": 5000, "relative-deadline-us": 50000, - "http-resp-size": 1024000, "http-resp-content-type": "image/png" }, { @@ -26,7 +24,6 @@ "path": "resize_image.wasm.so", "expected-execution-us": 5000, "relative-deadline-us": 50000, - "http-resp-size": 1524000, "http-resp-content-type": "image/png" } ] diff --git a/tests/sod/image_resize/test/spec.json b/tests/sod/image_resize/test/spec.json index 4e1e780..a88aa8d 100644 --- a/tests/sod/image_resize/test/spec.json +++ b/tests/sod/image_resize/test/spec.json @@ -10,7 +10,6 @@ "path": "resize_image.wasm.so", "expected-execution-us": 5000, "relative-deadline-us": 50000, - "http-resp-size": 1024000, "http-resp-content-type": "image/jpeg" } ] diff --git a/tests/sod/lpd/by_plate_count/spec.json b/tests/sod/lpd/by_plate_count/spec.json index c595066..0f24048 100644 --- a/tests/sod/lpd/by_plate_count/spec.json +++ b/tests/sod/lpd/by_plate_count/spec.json @@ -10,7 +10,6 @@ "path": "license_plate_detection.wasm.so", "expected-execution-us": 5000, "relative-deadline-us": 50000, - "http-resp-size": 1048576, "http-resp-content-type": "text/plain" }, { @@ -18,7 +17,6 @@ "path": "license_plate_detection.wasm.so", "expected-execution-us": 5000, "relative-deadline-us": 50000, - "http-resp-size": 1048576, "http-resp-content-type": "text/plain" }, { @@ -26,7 +24,6 @@ "path": "license_plate_detection.wasm.so", "expected-execution-us": 5000, "relative-deadline-us": 50000, - "http-resp-size": 1048576, "http-resp-content-type": "text/plain" } ] diff --git a/tests/speechtotext/spec.json b/tests/speechtotext/spec.json index a1c5f42..f3bcabf 100644 --- a/tests/speechtotext/spec.json +++ b/tests/speechtotext/spec.json @@ -9,7 +9,6 @@ "route": "/hello_ps", "path": "hello_ps.wasm.so", "relative-deadline-us": 50000, - "http-resp-size": 1048576, "http-resp-content-type": "image/jpeg" } ] diff --git a/tests/stack_overflow/spec.json b/tests/stack_overflow/spec.json index 4a1e6ac..1c4afc3 100644 --- a/tests/stack_overflow/spec.json +++ b/tests/stack_overflow/spec.json @@ -11,7 +11,6 @@ "expected-execution-us": 10000000, "admissions-percentile": 70, "relative-deadline-us": 20000000, - "http-resp-size": 1024, "http-resp-content-type": "text/plain" } ] diff --git a/tests/traps/spec.json b/tests/traps/spec.json index ca84754..60492df 100644 --- a/tests/traps/spec.json +++ b/tests/traps/spec.json @@ -11,7 +11,6 @@ "expected-execution-us": 10000000, "admissions-percentile": 70, "relative-deadline-us": 20000000, - "http-resp-size": 64, "http-resp-content-type": "text/plain" } ] diff --git a/tests/workload_mix/spec.json b/tests/workload_mix/spec.json index b59d586..b4c0992 100644 --- a/tests/workload_mix/spec.json +++ b/tests/workload_mix/spec.json @@ -11,7 +11,6 @@ "expected-execution-us": 6000, "admissions-percentile": 70, "relative-deadline-us": 20000, - "http-resp-size": 1024, "http-resp-content-type": "text/plain" }, { @@ -20,7 +19,6 @@ "expected-execution-us": 10000000, "admissions-percentile": 70, "relative-deadline-us": 20000000, - "http-resp-size": 1024, "http-resp-content-type": "text/plain" } ] diff --git a/tests/workload_mix_realworld/spec.json b/tests/workload_mix_realworld/spec.json index efd7281..f9e64a2 100644 --- a/tests/workload_mix_realworld/spec.json +++ b/tests/workload_mix_realworld/spec.json @@ -10,7 +10,6 @@ "path": "cifar10.wasm.so", "expected-execution-us": 2777, "relative-deadline-us": 4166, - "http-resp-size": 128, "http-resp-content-type": "text/plain", "admissions-percentile": 90 }, @@ -19,7 +18,6 @@ "path": "cifar10.wasm.so", "expected-execution-us": 2777, "relative-deadline-us": 4443, - "http-resp-size": 128, "http-resp-content-type": "text/plain", "admissions-percentile": 90 }, @@ -28,7 +26,6 @@ "path": "cifar10.wasm.so", "expected-execution-us": 2777, "relative-deadline-us": 4721, - "http-resp-size": 128, "http-resp-content-type": "text/plain", "admissions-percentile": 90 }, @@ -37,7 +34,6 @@ "path": "cifar10.wasm.so", "expected-execution-us": 2777, "relative-deadline-us": 4999, - "http-resp-size": 128, "http-resp-content-type": "text/plain", "admissions-percentile": 90 }, @@ -46,7 +42,6 @@ "path": "cifar10.wasm.so", "expected-execution-us": 2777, "relative-deadline-us": 5276, - "http-resp-size": 128, "http-resp-content-type": "text/plain", "admissions-percentile": 90 }, @@ -55,7 +50,6 @@ "path": "cifar10.wasm.so", "expected-execution-us": 2777, "relative-deadline-us": 5554, - "http-resp-size": 128, "http-resp-content-type": "text/plain", "admissions-percentile": 90 }, @@ -64,7 +58,6 @@ "path": "gps_ekf.wasm.so", "expected-execution-us": 158, "relative-deadline-us": 237, - "http-resp-size": 1024000, "http-resp-content-type": "application/octet-stream", "admissions-percentile": 90 }, @@ -73,7 +66,6 @@ "path": "gps_ekf.wasm.so", "expected-execution-us": 158, "relative-deadline-us": 253, - "http-resp-size": 1024000, "http-resp-content-type": "application/octet-stream", "admissions-percentile": 90 }, @@ -82,7 +74,6 @@ "path": "gps_ekf.wasm.so", "expected-execution-us": 158, "relative-deadline-us": 269, - "http-resp-size": 1024000, "http-resp-content-type": "application/octet-stream", "admissions-percentile": 90 }, @@ -91,7 +82,6 @@ "path": "gps_ekf.wasm.so", "expected-execution-us": 158, "relative-deadline-us": 284, - "http-resp-size": 1024000, "http-resp-content-type": "application/octet-stream", "admissions-percentile": 90 }, @@ -100,7 +90,6 @@ "path": "gps_ekf.wasm.so", "expected-execution-us": 158, "relative-deadline-us": 300, - "http-resp-size": 1024000, "http-resp-content-type": "application/octet-stream", "admissions-percentile": 90 }, @@ -109,7 +98,6 @@ "path": "gps_ekf.wasm.so", "expected-execution-us": 158, "relative-deadline-us": 316, - "http-resp-size": 1024000, "http-resp-content-type": "application/octet-stream", "admissions-percentile": 90 }, @@ -118,7 +106,6 @@ "path": "gocr.wasm.so", "expected-execution-us": 461831, "relative-deadline-us": 692746, - "http-resp-size": 5335057, "http-resp-content-type": "text/plain", "admissions-percentile": 90 }, @@ -127,7 +114,6 @@ "path": "gocr.wasm.so", "expected-execution-us": 461831, "relative-deadline-us": 738930, - "http-resp-size": 5335057, "http-resp-content-type": "text/plain", "admissions-percentile": 90 }, @@ -136,7 +122,6 @@ "path": "gocr.wasm.so", "expected-execution-us": 461831, "relative-deadline-us": 785113, - "http-resp-size": 5335057, "http-resp-content-type": "text/plain", "admissions-percentile": 90 }, @@ -145,7 +130,6 @@ "path": "gocr.wasm.so", "expected-execution-us": 461831, "relative-deadline-us": 831296, - "http-resp-size": 5335057, "http-resp-content-type": "text/plain", "admissions-percentile": 90 }, @@ -154,7 +138,6 @@ "path": "gocr.wasm.so", "expected-execution-us": 461831, "relative-deadline-us": 877479, - "http-resp-size": 5335057, "http-resp-content-type": "text/plain", "admissions-percentile": 90 }, @@ -163,7 +146,6 @@ "path": "gocr.wasm.so", "expected-execution-us": 461831, "relative-deadline-us": 923662, - "http-resp-size": 5335057, "http-resp-content-type": "text/plain", "admissions-percentile": 90 }, @@ -172,7 +154,6 @@ "path": "license_plate_detection.wasm.so", "expected-execution-us": 31597, "relative-deadline-us": 47396, - "http-resp-size": 1048576, "http-resp-content-type": "text/plain", "admissions-percentile": 90 }, @@ -181,7 +162,6 @@ "path": "license_plate_detection.wasm.so", "expected-execution-us": 31597, "relative-deadline-us": 50555, - "http-resp-size": 1048576, "http-resp-content-type": "text/plain", "admissions-percentile": 90 }, @@ -190,7 +170,6 @@ "path": "license_plate_detection.wasm.so", "expected-execution-us": 31597, "relative-deadline-us": 53715, - "http-resp-size": 1048576, "http-resp-content-type": "text/plain", "admissions-percentile": 90 }, @@ -199,7 +178,6 @@ "path": "license_plate_detection.wasm.so", "expected-execution-us": 31597, "relative-deadline-us": 56875, - "http-resp-size": 1048576, "http-resp-content-type": "text/plain", "admissions-percentile": 90 }, @@ -208,7 +186,6 @@ "path": "license_plate_detection.wasm.so", "expected-execution-us": 31597, "relative-deadline-us": 60034, - "http-resp-size": 1048576, "http-resp-content-type": "text/plain", "admissions-percentile": 90 }, @@ -217,7 +194,6 @@ "path": "license_plate_detection.wasm.so", "expected-execution-us": 31597, "relative-deadline-us": 63194, - "http-resp-size": 1048576, "http-resp-content-type": "text/plain", "admissions-percentile": 90 }, @@ -226,7 +202,6 @@ "path": "resize_image.wasm.so", "expected-execution-us": 138903, "relative-deadline-us": 208354, - "http-resp-size": 1524000, "http-resp-content-type": "image/png", "admissions-percentile": 90 }, @@ -235,7 +210,6 @@ "path": "resize_image.wasm.so", "expected-execution-us": 138903, "relative-deadline-us": 222245, - "http-resp-size": 1524000, "http-resp-content-type": "image/png", "admissions-percentile": 90 }, @@ -244,7 +218,6 @@ "path": "resize_image.wasm.so", "expected-execution-us": 138903, "relative-deadline-us": 236135, - "http-resp-size": 1524000, "http-resp-content-type": "image/png", "admissions-percentile": 90 }, @@ -253,7 +226,6 @@ "path": "resize_image.wasm.so", "expected-execution-us": 138903, "relative-deadline-us": 250025, - "http-resp-size": 1524000, "http-resp-content-type": "image/png", "admissions-percentile": 90 }, @@ -262,7 +234,6 @@ "path": "resize_image.wasm.so", "expected-execution-us": 138903, "relative-deadline-us": 263916, - "http-resp-size": 1524000, "http-resp-content-type": "image/png", "admissions-percentile": 90 }, @@ -271,7 +242,6 @@ "path": "resize_image.wasm.so", "expected-execution-us": 138903, "relative-deadline-us": 277806, - "http-resp-size": 1524000, "http-resp-content-type": "image/png", "admissions-percentile": 90 }