From 89d1f414bdfa116a200187912e5090083688d75c Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Mon, 25 Jan 2016 02:23:25 +0100 Subject: BUG/MEDIUM: buffers: do not round up buffer size during allocation MIME-Version: 1.0 Content-Type: text/plain; charset=latin1 Content-Transfer-Encoding: 8bit When users request 16384 bytes for a buffer, they get 16392 after rounding up. This is problematic for SSL as it systematically causes a small 8-bytes message to be appended after the first 16kB message and costs about 15% of performance. Let's add MEM_F_EXACT to use exactly the size we need. This requires previous patch (MEDIUM: pools: add a new flag to avoid rounding pool size up). This issue was introduced in 1.6 and causes trouble there, so this fix must be backported. This is issue was reported by Gary Barrueto and diagnosed by Cyril Bonté. (cherry picked from commit 484b53da5218034898964d8270da0d27f9de66a0) --- src/buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/buffer.c b/src/buffer.c index b083768..f47fbdd 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -36,7 +36,7 @@ int init_buffer() { void *buffer; - pool2_buffer = create_pool("buffer", sizeof (struct buffer) + global.tune.bufsize, MEM_F_SHARED); + pool2_buffer = create_pool("buffer", sizeof (struct buffer) + global.tune.bufsize, MEM_F_SHARED|MEM_F_EXACT); if (!pool2_buffer) return 0; -- 1.7.12.1