<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">I am able to reproduce the issue @wkbrad is reporting<div><br></div><div><div>[root@server1 ~]# ps_mem|head -1 && ps_mem|grep nginx</div><div> Private + Shared = RAM used Program </div><div> 25.3 MiB + 119.5 MiB = 144.9 MiB nginx (3)</div><div>[root@server1 ~]# systemctl restart nginx</div><div>[root@server1 ~]# ps_mem|head -1 && ps_mem|grep nginx</div><div> Private + Shared = RAM used Program </div><div> 24.2 MiB + 58.1 MiB = 82.2 MiB nginx (4) --------------------------> notice the sharedmemory usage is half os what is used before restart</div><div>[root@server1 ~]# ps_mem|head -1 && ps_mem|grep nginx</div><div> Private + Shared = RAM used Program </div><div> 23.1 MiB + 57.9 MiB = 81.0 MiB nginx (3) ---------------------------> the cache loader process exits and the ram usage remain same</div><div>[root@server1 ~]# nginx -s reload ---------------------------> A graceful reload is performed on Nginx</div><div>[root@server1 ~]# ps_mem|head -1 && ps_mem|grep nginx</div><div> Private + Shared = RAM used Program </div><div> 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</div><div><br></div><div><br></div><div><br></div><div>##############################################################################</div></div><div><br></div><div>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</div><div><br></div><div><div>[root@server1 ~]# systemctl restart nginx</div><div>[root@server1 ~]# ps aux|grep nginx</div><div>root 22392 0.0 0.7 510316 62184 ? Ss 13:49 0:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf</div></div><div><div>[root@server1 ~]# pmap -X 22392|head -2 && pmap -X 22392|grep heap</div><div>22392: nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf</div><div> Address Perm Offset Device Inode Size Rss Pss Referenced Anonymous Swap Locked Mapping</div><div> 01b10000 rw-p 00000000 00:00 0 61224 58688 17187 80 58688 0 0 [heap]</div></div><div><br></div><div><br></div><div>Now after the reload</div><div><br></div><div><br></div><div><div>[root@server1 ~]# pmap -X 20983|head -2 && pmap -X 20983|grep heap</div><div>20983: nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf</div><div> Address Perm Offset Device Inode Size Rss Pss Referenced Anonymous Swap Locked Mapping</div><div> 02780000 rw-p 00000000 00:00 0 61224 61220 23118 51540 61220 0 0 [heap]</div><div> 0634a000 rw-p 00000000 00:00 0 57856 55360 19138 55360 55360 0 0 [heap]</div></div><div>###########################################################################</div><div><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 12, 2019 at 2:07 AM wkbrad <<a href="mailto:nginx-forum@forum.nginx.org">nginx-forum@forum.nginx.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi All,<br>
<br>
I think I haven't been clear in what I'm seeing so let's start over. :) I<br>
set up a very simple test on Centos 7 with a default install of Nginx<br>
1.12.2. Below is exactly what I did to produce the result and it's clear to<br>
me that Nginx is using 2x the ram than it should be using after the first<br>
reload. Can anyone explain why the ram usage would double after doing a<br>
config reload?<br>
<br>
yum update<br>
reboot<br>
yum install epel-release<br>
yum install nginx<br>
systemctl enable nginx<br>
systemctl start nginx<br>
yum install ps_mem vim<br>
cd /etc/nginx/<br>
vim vhost.template<br>
--------------------------------------------------------------------------------<br>
server {<br>
listen 80;<br>
listen [::]:80;<br>
<br>
server_name {{DOMAIN}};<br>
<br>
root /var/www/html;<br>
index index.html;<br>
<br>
location / {<br>
try_files $uri $uri/ =404;<br>
}<br>
}<br>
--------------------------------------------------------------------------------<br>
cd conf.d<br>
for i in $(seq -w 1 50000); do sed 's/{{DOMAIN}}/dom'${i}'.com/'<br>
../vhost.template > dom${i}.conf; done<br>
systemctl restart nginx<br>
ps_mem|grep nginx<br>
--------------------------------------------------------------------------------<br>
13.8 MiB + 750.7 MiB = 764.5 MiB nginx (3)<br>
--------------------------------------------------------------------------------<br>
systemctl reload nginx; sleep 60; ps_mem |grep nginx<br>
--------------------------------------------------------------------------------<br>
27.2 MiB + 1.4 GiB = 1.5 GiB nginx (3)<br>
<br>
Posted at Nginx Forum: <a href="https://forum.nginx.org/read.php?2,283216,283344#msg-283344" rel="noreferrer" target="_blank">https://forum.nginx.org/read.php?2,283216,283344#msg-283344</a><br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><b>Anoop P Alias</b> <div><br></div></div></div></div>