Skip to content

Setting nginx 'proxy-buffer-size' to 16k causes nginx config error #363

@whereisaaron

Description

@whereisaaron

TL;DR: Increasing nginx proxy_buffers_size with the proxy-buffer-size setting needs to be coupled with a suitable increase in the proxy_buffers buffer pool.

@vyshane added a useful patch that adds a proxy-buffer-size ConfigMap setting that sets the proxy_buffer_size in the nginx config. This causes a problem though, because proxy_buffer_size is tightly coupled to proxy_buffers; You can't make the proxy_buffer_size larger if you can't also increase the size of the proxy_buffers buffer pool. E.g. currently if you set proxy-buffer-size to 16k, the nginx controller will fail with:

[emerg] 19#19: "proxy_busy_buffers_size" must be less than the size of all "proxy_buffers" minus one buffer in /tmp/nginx-cfg612772959:2175

This is because the default proxy_buffers setting is 4 x 4k buffers = 16k total, and you need at least one buffer left over for buffering in the other direction. Increasing proxy_buffers_size needs to be coupled with a matching increase in the buffer pool.

(Note that the proxy_buffers pool is still used, evening when proxy_buffering is set to off. This is because 'proxy_buffering' relates only to buffering to disk. Yeah. Thanks nginx 😃)

You could either add user control of the the proxy_buffers setting or you apply proxy-buffer-size to both settings, e.g. if proxy-buffer-size is set to 16k, the nginx config could be:

proxy_buffer_size                       16k;
proxy_buffers                           4 16k;

or, if you believe more buffers that are page-sized and page-aligned are more efficient:

proxy_buffer_size                       16k;
proxy_buffers                           16 4k;

@aledbf had a proposal too:

@whereisaaron please open an issue with ^^ and we will calculate proxy_busy_buffers_size using the proxy_buffers size (like the server hash tables)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions