Welcome! Log In Create A New Profile

Advanced

Re: Possible memory leak?

Maxim Dounin
February 28, 2019 03:08PM
Hello!

On Thu, Feb 28, 2019 at 01:43:18PM -0500, wkbrad wrote:

> We're running Nginx version 1.15.8 but we've been seeing similar issues with
> other versions too and on all of our servers that have a high number of
> vhosts.
>
> The issue is that when you do an nginx reload it ends up using almost 2x the
> ram as it was previously. Here is a test I ran.
> --------------------------------------------------------------------------------
> 21.3 MiB + 1.4 GiB = 1.4 GiB nginx (3)
> 21.3 MiB + 1.4 GiB = 1.4 GiB nginx (3)
> 484.2 MiB + 1.4 GiB = 1.9 GiB nginx (3)
> 588.1 MiB + 1.4 GiB = 2.0 GiB nginx (3)
> 720.3 MiB + 1.4 GiB = 2.1 GiB nginx (3)
> 1.4 GiB + 1.4 GiB = 2.8 GiB nginx (3)
> 18.0 MiB + 2.7 GiB = 2.7 GiB nginx (3)
> 20.8 MiB + 2.7 GiB = 2.7 GiB nginx (3)
> 20.8 MiB + 2.7 GiB = 2.7 GiB nginx (3)
> --------------------------------------------------------------------------------
>
> I expect the ram usage to increase while the reload is happening but after
> it's done shouldn't the ram usage go back to about the same level?
>
> This issue is completely reproducible across all of our servers and if I do
> a full restart, ram usage goes back down to normal.
>
> Any thoughts?

Configuration reload implies that master process parses the
configuration and creates new configuration structures in memory.
That is, memory usage is expected to be 2x compared to a clean
startup assuming most of the memory is used for the configuration.

Once the configuration is correctly parsed and applied, master
process will free the old configuration. At this point memory
usage is expected to be the same as after a clean start, but given
memory allocation details it is almost never the case.

For example, assuming the system allocator simply uses sbrk()
without any caching, after the configuration reload the new
configuration will use addresses higher than the original one
used, so allocator will not be able to release no-longer-needed
memory (previously used by the original configuration) to the
system.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Possible memory leak?

wkbrad February 28, 2019 01:43PM

Re: Possible memory leak?

Maxim Dounin February 28, 2019 03:08PM

Re: Possible memory leak?

wkbrad February 28, 2019 03:54PM

Re: Possible memory leak?

Maxim Dounin February 28, 2019 04:50PM

Re: Possible memory leak?

wkbrad February 28, 2019 05:06PM

RE: Possible memory leak?

Reinis Rozitis February 28, 2019 05:28PM

Re: Possible memory leak?

Alceu R. de Freitas Jr. via nginx February 28, 2019 06:02PM

Re: RE: Possible memory leak?

wkbrad February 28, 2019 06:44PM

Re: Possible memory leak?

wkbrad March 07, 2019 01:33PM

Re: Possible memory leak?

Anoop Alias March 07, 2019 08:06PM

Re: Possible memory leak?

wkbrad March 07, 2019 09:35PM

Re: Possible memory leak?

Anoop Alias March 07, 2019 10:10PM

Re: Possible memory leak?

wkbrad March 08, 2019 10:39AM

Re: Possible memory leak?

Anoop Alias March 08, 2019 06:54PM

Re: Possible memory leak?

gariac March 08, 2019 01:10AM

Re: Possible memory leak?

wkbrad March 08, 2019 10:42AM

Re: Possible memory leak?

gariac March 08, 2019 08:08PM

Re: Possible memory leak?

wkbrad March 11, 2019 04:37PM

Re: Possible memory leak?

Anoop Alias March 12, 2019 09:56AM

Re: Possible memory leak?

Maxim Dounin March 12, 2019 10:40AM

Re: Possible memory leak?

Anoop Alias March 12, 2019 11:00AM

Re: Possible memory leak?

Maxim Dounin March 12, 2019 11:48AM

Re: Possible memory leak?

wkbrad March 12, 2019 02:09PM

Re: Possible memory leak?

Maxim Dounin March 12, 2019 09:58PM

Re: Possible memory leak?

Peter Booth via nginx March 13, 2019 01:44AM

Re: Possible memory leak?

Anoop Alias March 13, 2019 01:54AM

Re: Possible memory leak?

wkbrad March 20, 2019 06:41PM

Re: Possible memory leak?

Maxim Dounin March 21, 2019 09:46AM

Re: Possible memory leak?

Maxim Dounin March 21, 2019 09:48AM

Re: Possible memory leak?

wkbrad March 21, 2019 11:29AM

Re: Possible memory leak?

Maxim Dounin March 21, 2019 02:18PM

Re: Possible memory leak?

wkbrad March 21, 2019 05:55PM

Re: Possible memory leak?

Maxim Dounin March 25, 2019 08:40AM

Re: Possible memory leak?

wkbrad March 27, 2019 02:54PM

Re: Possible memory leak?

Maxim Dounin March 27, 2019 04:26PM

Re: Possible memory leak?

gariac March 13, 2019 01:58AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 90
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready