Потребление памяти nginx'ом

Alex Vorona voron at amhost.net
Tue Nov 4 19:49:24 MSK 2008


04.11.2008 17:52, Igor Sysoev wrote:
> On Fri, Oct 31, 2008 at 06:16:07PM +0200, Alex Vorona wrote:
> 
>> Наблюдаю интересную картину - после релоада nginx кушает в 2 раза больше 
>> памяти, рестарт/обновление бинарника возвращают потребление в норму.
>>
>> Судя по http://www.lexa.ru/nginx-ru/msg16264.html, двойное увеличение 
>> потребления памяти должно быть только на время переконфигурации.
>>
>> [root at host]# /usr/local/etc/rc.d/nginx start
>> Performing sanity check on nginx configuration:
>> 2008/10/31 11:50:55 [info] 53360#0: the configuration file 
>> /usr/local/etc/nginx/nginx.conf syntax is ok
>> 2008/10/31 11:50:55 [info] 53360#0: the configuration file 
>> /usr/local/etc/nginx/nginx.conf was tested successfully
>> Starting nginx.
>> [root at host]# ps uax|grep nginx
>> root     53381  0.0 15.3 158056 156376  ??  Ss   11:51AM   0:00.02 nginx: 
>> master process /usr/local/sbin/nginx
>> apache   53382  0.0 15.3 158056 156420  ??  S<   11:51AM   0:00.02 nginx: 
>> worker process (nginx)
>> root     53399  0.0  0.1  3308   920  p5  S+   11:51AM   0:00.00 grep nginx
>> [root at host]# kill -1 53381
>> [root at host]# ps uax|grep nginx
>> root     53381 36.5 28.4 293224 291092  ??  Ss   11:51AM   0:04.73 nginx: 
>> master process /usr/local/sbin/nginx
>> apache   53433  0.0 28.4 293224 291100  ??  S<   11:51AM   0:00.01 nginx: 
>> worker process (nginx)
>> root     53435  0.0  0.1  3308   920  p5  S+   11:51AM   0:00.00 grep nginx
>> [root at host]#
>> [root at host]# /usr/local/etc/rc.d/nginx restart
>> Performing sanity check on nginx configuration:
>> 2008/10/31 12:00:08 [info] 54818#0: the configuration file 
>> /usr/local/etc/nginx/nginx.conf syntax is ok
>> 2008/10/31 12:00:08 [info] 54818#0: the configuration file 
>> /usr/local/etc/nginx/nginx.conf was tested successfully
>> Stopping nginx.
>> Waiting for PIDS: 53381.
>> Performing sanity check on nginx configuration:
>> 2008/10/31 12:00:15 [info] 54831#0: the configuration file 
>> /usr/local/etc/nginx/nginx.conf syntax is ok
>> 2008/10/31 12:00:15 [info] 54831#0: the configuration file 
>> /usr/local/etc/nginx/nginx.conf was tested successfully
>> Starting nginx.
>> [root at host]# ps uax|grep nginx
>> root     54927  0.0 15.3 158056 156316  ??  Ss   12:00PM   0:00.02 nginx: 
>> master process /usr/local/sbin/nginx
>> apache   54928  0.0 15.3 158056 156336  ??  S<   12:00PM   0:00.02 nginx: 
>> worker process (nginx)
>> root     54949  0.0  0.1  3308   924  p5  S+   12:00PM   0:00.00 grep nginx
>> [root at host]#
>> Запросы к nginx - только от мониоринга раз в минуту
>> [root at host]# curl http://127.0.0.1:8000
>> Active connections: 1
>> server accepts handled requests
>>  15 15 15
>> Reading: 0 Writing: 1 Waiting: 0
>>
>> Около 8к доменов с конфигурацией
>>
>>     server {
>>         listen      1.2.3.4:80;
>>         server_name www.domain.tld domain.tld;
>>         root /home/user/domains/domain.tld/public_html;
>>         access_log /var/log/httpd/domains/domain.tld.bytes bytes buffer=8k;
>>         error_log  /var/log/nginx/www.domain.tld.error.log  warn;
>>         location / {
>>                 proxy_pass   http://1.2.3.4:81;
>>                 proxy_redirect http://www.domain.tld:81 
>>                 http://www.domain.tld;
>>                 proxy_redirect http://domain.tld:81 http://domain.tld;
>>         }
>>
>>         include vhost_static.conf;
>>
>>     }
>> [root at host]# grep -v '#' vhost_static.conf
>>
>>         location ~ 
>> \.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|wmv|wma|mp3|mpg|avi|mpeg|mp4|divx)$ 
>> {
>>
>>         }
>>         location = /50x.html {
>>             root   html;
>>         }
>>         location ~ /\.ht {
>>             deny  all;
>>         }
>> [root at host]#
>>
>> [root at host]# uname -rm
>> 7.0-RELEASE i386
> 
> Возможно, дело в новом malloc()е. Можно попробовать запустить так:
> 
> MALLOC_OPTIONS=Dm /usr/local/nginx/nginx
> 
> И добавить в nginx.conf:
> 
> env   MALLOC_OPTIONS=Dm;
> 
> на случай апгрэйда.
> 
> 

[root at host]# MALLOC_OPTIONS=Dm `which nginx`
nginx: (malloc) Unsupported character in malloc options: 'D'
nginx: (malloc) Unsupported character in malloc options: 'm'
^C





More information about the nginx-ru mailing list