Welcome! Log In Create A New Profile

Advanced

Re: Memory use flares up sharply, how to troubleshoot?

Maxim Dounin
July 21, 2014 12:40PM
Hello!

On Mon, Jul 21, 2014 at 11:15:00AM -0400, gthb wrote:

> Several times recently, we have seen our production nginx memory usage flare
> up a hundred-fold, from its normal ~42 MB to 3-4 GB, for 20 minutes to an
> hour or so, and then recover. There is not a spike in number of connections,
> just memory use, so whatever causes this, it does not seem to be an increase
> in concurrency.
>
> The obvious thing to suspect for this is our app's newest change, which
> involves streaming responses proxied from an upstream (via uwsgi_pass);
> these responses can get very large and run for many minutes, pumping
> hundreds of megabytes each. But I expect nginx memory use for these requests
> to be bounded by uwsgi_buffers (shouldn't it be?) -- and indeed I cannot
> reproduce the problem by making such requests, even copying the exact ones
> that are being made when the memory spike occurs. In my tests, the responses
> get buffered as they should be, and delivered normally, without memory
> growth.

How do you track "nginx memory"?

From what you describe I suspect that disk buffering occurs (see
http://nginx.org/r/uwsgi_max_temp_file_size), and the number you
are looking at includes the size of files on disk.

> So, what is a good way to investigate what causes all this memory to be
> suddenly allocated? Is there a way of introspecting/logging nginx memory
> allocation edge cases like this? (Is there documentation on this which I
> didn't find?)

The debuging log includes full information about all memory
allocations, see http://nginx.org/en/docs/debugging_log.html.

--
Maxim Dounin
http://nginx.org/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Memory use flares up sharply, how to troubleshoot?

gthb July 21, 2014 11:15AM

Re: Memory use flares up sharply, how to troubleshoot?

Maxim Dounin July 21, 2014 12:40PM

Re: Memory use flares up sharply, how to troubleshoot?

gthb July 21, 2014 02:18PM

Re: Memory use flares up sharply, how to troubleshoot?

Maxim Dounin July 21, 2014 03:34PM

Re: Memory use flares up sharply, how to troubleshoot?

gthb July 21, 2014 05:44PM

Re: Memory use flares up sharply, how to troubleshoot?

Maxim Dounin July 22, 2014 07:54AM

Re: Memory use flares up sharply, how to troubleshoot?

gthb July 22, 2014 10:51AM

Re: Memory use flares up sharply, how to troubleshoot?

Maxim Dounin July 22, 2014 12:04PM

Re: Memory use flares up sharply, how to troubleshoot?

gthb July 22, 2014 01:07PM

Re: Memory use flares up sharply, how to troubleshoot?

Maxim Dounin July 22, 2014 03:38PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 212
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready