From 83f890e89e1e04e169699bca8c9c3ced545af3a6 Mon Sep 17 00:00:00 2001 From: Joris Vink Date: Wed, 30 Jul 2014 13:20:27 +0200 Subject: [PATCH] No longer preallocate worker_max_connections for the http pools. Instead use 10% of worker_max_connections up to a maximum of 1000. --- src/http.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/http.c b/src/http.c index 26d7de5..3afb106 100644 --- a/src/http.c +++ b/src/http.c @@ -62,15 +62,18 @@ u_int64_t http_postbody_max = HTTP_POSTBODY_MAX_LEN; void http_init(void) { + int prealloc; + http_request_count = 0; TAILQ_INIT(&http_requests); TAILQ_INIT(&http_requests_sleeping); + prealloc = MIN((worker_max_connections / 10), 1000); + kore_pool_init(&http_request_pool, "http_request_pool", - sizeof(struct http_request), worker_max_connections); + sizeof(struct http_request), prealloc); kore_pool_init(&http_header_pool, "http_header_pool", - sizeof(struct http_header), - worker_max_connections * HTTP_REQ_HEADER_MAX); + sizeof(struct http_header), prealloc * HTTP_REQ_HEADER_MAX); } int