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-fo...@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