Files still on disc after inactive time

Maxim Dounin mdounin at mdounin.ru
Wed Mar 21 15:41:00 UTC 2018


Hello!

On Wed, Mar 21, 2018 at 05:52:20AM -0400,  Grzegorz Ćwikliński wrote:

> As you said before killing nginx worker is connected with third party module
> which is Linux kernel Out Of Memory killer. 
> 
> Because nginx is using too much memory OOM killer score is about 800-900
> point where 1000 is maximum, which is why kernel is killing out nginx
> worker, and after that files in tmp catalog are not deleted and disc is
> full. 
> 
> About configuration, we are storing 40GB cache because size of files which
> are stored is about 700MB to 1GB and stored for 1d. Our machines have 24GB
> and at some time nginx uses 22GB-23GB, and after that OOM killer start and
> kill our worker.

Ok, so the behaviour observed with cache files not being removed 
is an expected result of the OOM killer activity.  No need to 
investigate it any further.  Instead, let's focus on what causes 
the problem - RAM usage.

> My question is why nginx is using so much RAM, and how to prevent nginx from
> using so much RAM. Or other possibilities to stop killing nginx worker.

Amount of RAM nginx can use depends on the configuration and a 
particular workload.  As per the only configuration snippet given 
in this thread, nginx is expected to use at least 4G of shared 
memory for cache keys zone.

In typical configurations, most of RAM is spent on various 
per-connection buffers - including client_header_buffer, 
large_client_header_buffers, proxy_buffers, proxy_buffer_size, 
output_buffers, and so on.  Even with relatively small defaults 
these can be a lot if there are thousands of connections.

What exactly happens in your case requires detailed investigation, 
and unlikely it is something that can be done at least without 
such basic things as "nginx -V" output and full nginx configuration.

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx mailing list