Increasing Memory Usage

Maxim Dounin mdounin at mdounin.ru
Thu Jul 30 14:17:11 MSD 2009


Hello!

On Wed, Jul 29, 2009 at 11:21:36PM -0400, flute wrote:

> I'm using Nginx 0.7.61 with php-fpm(php 5.2.6) on Freebsd7.1-amd64。
> When i  starte nginx,the total memory usage beging Increase. Unitl used all memory.
> use top with sort size,i'm look at the each nginx work process used more than 400M memory.
> The solution is used 'kill -HUP'
> http://ylem.guanxi.koubei.com/ylem/get?version=1.0&enc=5tGKrFjjiG4DONY0WlR1IZ0oHeSR1ZHTVJEzyXe_yDhNYfzLaR.D0wpSXWZ_iAy_YJZ9nmwW2x55Lmp0Xly1A1s-
> why nginx used so many memory?
> 
> nginx.conf
> 
> 
> pid        /var/run/nginx.pid;
> worker_rlimit_nofile 200000;
> events {
>     worker_connections  20000;

[...]

> 		location / {
>               FileETag on;
>               etag_format "%X%X";

As Igor already suggested, this may be caused by a memory leak in etag 
module.  Could you please try to reproduce problem without it?

[...]

> 		location /phppost {
> 			internal;
>     		access_log  /logs/nginx/access.log  main;
> 			proxy_set_header   Cookie        "$http_cookie;Real_IP=$remote_addr";
> 			proxy_method POST; 
> 			proxy_connect_timeout 60;
> 			proxy_buffers 32 128k;
> 			proxy_ignore_client_abort on;


Note well that each nginx worker may use up to 
worker_connections * proxy_buffers[count] * proxy_buffers[size] 
memory just for proxy buffers.

This counts to 80G in your case, probably a bit too many.  Try 
decreasing proxy_buffers to see if it helps.

Maxim Dounin





More information about the nginx mailing list