High memory usage

J.R. themadbeaker at gmail.com
Sun Oct 27 17:40:06 UTC 2019


Few things...

brotli_comp_level  should probably be something like 5, setting to 9
would be rather CPU intensive (much more than gzip 9).

Some of your proxy buffer settings seem rather excessive... Something
like this would probably be sufficient unless you have some *really*
large files coming from upstream.

proxy_buffer_size       8k;
proxy_busy_buffers_size 16k;
proxy_buffers           64 4k

A good read for proxy settings that I've found is:
https://www.getpagespeed.com/server-setup/nginx/tuning-proxy_buffer_size-in-nginx

You should set your SSL settings at the 'http' level, including
default certificates. Then in each 'server' directive you can
re-define the certificates when necessary.

You can also set all the common proxy_set_header vars at the 'http'
level instead of duplicating for each server. Maybe also look into
using a common upstream zone instead of always defining the proxy.

Finally, just because I would check your PHP-FPM settings (not in
nginx)... Make sure that at the very least:

pm = ondemand
pm.max_request = 1000

I've seen at times where not setting a max_request leads to eating up
ram in Apache, could possibly be an issue with Nginx.

Nothing else really stands out. I would just try to decrease buffers
where you can, especially those that are created for each server
instance. With all the vhosts you have that can really add up quickly.

Jason


More information about the nginx mailing list