Anoop Alias
March 12, 2019 09:56AM
I am able to reproduce the issue @wkbrad is reporting

[root@server1 ~]# ps_mem|head -1 && ps_mem|grep nginx
Private + Shared = RAM used Program
25.3 MiB + 119.5 MiB = 144.9 MiB nginx (3)
[root@server1 ~]# systemctl restart nginx
[root@server1 ~]# ps_mem|head -1 && ps_mem|grep nginx
Private + Shared = RAM used Program
24.2 MiB + 58.1 MiB = 82.2 MiB nginx (4)
--------------------------> notice the sharedmemory usage is half os what
is used before restart
[root@server1 ~]# ps_mem|head -1 && ps_mem|grep nginx
Private + Shared = RAM used Program
23.1 MiB + 57.9 MiB = 81.0 MiB nginx (3)
---------------------------> the cache loader process exits and the ram
usage remain same
[root@server1 ~]# nginx -s reload
---------------------------> A graceful reload is performed on Nginx
[root@server1 ~]# ps_mem|head -1 && ps_mem|grep nginx
Private + Shared = RAM used Program
15.8 MiB + 118.8 MiB = 134.5 MiB nginx (3)
----------------------------> The shared RAM size doubles and stay at this
value till another restart is performed



##############################################################################

I think this is because the pmap shows 2 heaps after reload whereas there
is only one right after the restart , An additional heap appears after
reload

[root@server1 ~]# systemctl restart nginx
[root@server1 ~]# ps aux|grep nginx
root 22392 0.0 0.7 510316 62184 ? Ss 13:49 0:00 nginx:
master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
[root@server1 ~]# pmap -X 22392|head -2 && pmap -X 22392|grep heap
22392: nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
Address Perm Offset Device Inode Size Rss Pss
Referenced Anonymous Swap Locked Mapping
01b10000 rw-p 00000000 00:00 0 61224 58688 17187
80 58688 0 0 [heap]


Now after the reload


[root@server1 ~]# pmap -X 20983|head -2 && pmap -X 20983|grep heap
20983: nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
Address Perm Offset Device Inode Size Rss Pss
Referenced Anonymous Swap Locked Mapping
02780000 rw-p 00000000 00:00 0 61224 61220 23118
51540 61220 0 0 [heap]
0634a000 rw-p 00000000 00:00 0 57856 55360 19138
55360 55360 0 0 [heap]
###########################################################################


On Tue, Mar 12, 2019 at 2:07 AM wkbrad <nginx-forum@forum.nginx.org> wrote:

> Hi All,
>
> I think I haven't been clear in what I'm seeing so let's start over. :) I
> set up a very simple test on Centos 7 with a default install of Nginx
> 1.12.2. Below is exactly what I did to produce the result and it's clear
> to
> me that Nginx is using 2x the ram than it should be using after the first
> reload. Can anyone explain why the ram usage would double after doing a
> config reload?
>
> yum update
> reboot
> yum install epel-release
> yum install nginx
> systemctl enable nginx
> systemctl start nginx
> yum install ps_mem vim
> cd /etc/nginx/
> vim vhost.template
>
> --------------------------------------------------------------------------------
> server {
> listen 80;
> listen [::]:80;
>
> server_name {{DOMAIN}};
>
> root /var/www/html;
> index index.html;
>
> location / {
> try_files $uri $uri/ =404;
> }
> }
>
> --------------------------------------------------------------------------------
> cd conf.d
> for i in $(seq -w 1 50000); do sed 's/{{DOMAIN}}/dom'${i}'.com/'
> ../vhost.template > dom${i}.conf; done
> systemctl restart nginx
> ps_mem|grep nginx
>
> --------------------------------------------------------------------------------
> 13.8 MiB + 750.7 MiB = 764.5 MiB nginx (3)
>
> --------------------------------------------------------------------------------
> systemctl reload nginx; sleep 60; ps_mem |grep nginx
>
> --------------------------------------------------------------------------------
> 27.2 MiB + 1.4 GiB = 1.5 GiB nginx (3)
>
> Posted at Nginx Forum:
> https://forum.nginx.org/read.php?2,283216,283344#msg-283344
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>


--
*Anoop P Alias*
_______________________________________________
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: 69
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