commit 83f890e89e1e04e169699bca8c9c3ced545af3a6
parent e1dff2e0515fbbaab4b4e0b6ab38b06a34ad3e3a
Author: Joris Vink <joris@coders.se>
Date: Wed, 30 Jul 2014 13:20:27 +0200
No longer preallocate worker_max_connections for the http pools.
Instead use 10% of worker_max_connections up to a maximum of 1000.
Diffstat:
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git 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