Memory issue

Maxim Dounin mdounin at
Thu Apr 6 15:23:20 UTC 2017


On Wed, Apr 05, 2017 at 09:32:41PM -0400, JohnCarne wrote:

> We described it properly when opening ticket, I reformulate :
> Usually, 1 nginx worker process consumes 1.16-2% of RAM maximum on this
> server, and it remain stable.
> For some days after nginx upgrades, every overnight, during daily stat
> generation process of cpanel which happens on overnight like set, there is
> many nginx reloads due to stat generation (= normal), but this is now
> causing an ever increasing memory use of RAM by nginx worker process,
> usually it stays around 1-2% RAM, we now see it cumulating after stat
> generation process increasing itself at begin with 1-2% RAM each time, which
> will lead after some weaks to a saturated server in term of RAM if nginx is
> not started. When we saw the issue first time, Nginx was consuming 12% of
> server RAM considering we have 128 GB RAM on this shared hosting server.
> After recent nginx upgrade :
> The increase is around 0.20% daily, instead of 1-2% RAM

So, you observe one nginx worker process consuming about 12% of 
your server RAM, that is, more than 10GB of memory, correct?  You 
may want to provide something like "ps alx | grep nginx" output 
to illustrate the problem.

You may start with the following basic steps:

- Check your "nginx -V" output and nginx configuration; disable 
  3rd party modules if there are any, and check if the problem 
  persists.  In many cases various obscure problems are introduced 
  by bugs in 3rd party modules.

- Make sure you are talking about a single worker process memory 
  consumption, and not overral memory consumption of all nginx 
  worker processes.  Multiple configuration reloads can leave 
  multiple nginx worker processes in the "shutting down..." state 
  for a long time which depends on the particular workload, and it 
  is not a surprise you need memory if you do lots of configuration 

- Check your nginx configuration to see if there natural reasons 
  to consume memory - multiple connections and large buffers 
  configured, thousands of complex location configurtions, large 
  shared memory zones, and so on.

- Try to find out what exactly causes increased memory 
  consumption.  The "stats generation process" you write about is 
  not something nginx does by itself, and it is completely unknown 
  what it means for anyone except you.

If the above won't be enough for you to identify the problem, 
consider providing additional information about the observed 
proble, including "ps alx" output which demonstrates the problem, 
"nginx -V" output, and full nginx configuration (shown with 
"nginx -T").

Maxim Dounin

More information about the nginx mailing list