]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
login-proxy: Use persistent istream buffers
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 10 Nov 2020 14:10:05 +0000 (16:10 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Thu, 3 Dec 2020 12:25:55 +0000 (12:25 +0000)
Constantly freeing and allocating the memory is a bit slow, but because
Dovecot allocates all memory with calloc() the memory cleaing is especially
slow. With this change proxying lots of data in a plaintext connection
takes about 50% less CPU. The downside is that it uses about 4 kB more
memory per istream (8 kB total, for both client and server connections),
but that shouldn't be too bad for proxies since they don't use much memory
otherwise.

src/login-common/login-proxy.c

index 53c4f9bf086a9f5143fdd37abfc6a5eb6e28f7ee..81255c74771d08252144a665bdedf90bd3600250 100644 (file)
@@ -707,8 +707,6 @@ void login_proxy_detach(struct login_proxy *proxy)
        proxy->client_input = client->input;
        proxy->client_output = client->output;
 
-       i_stream_set_persistent_buffers(proxy->server_input, FALSE);
-       i_stream_set_persistent_buffers(client->input, FALSE);
        o_stream_set_max_buffer_size(client->output, PROXY_MAX_OUTBUF_SIZE);
        client->input = NULL;
        client->output = NULL;