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

Alex Vorona voron at amhost.net
Fri Oct 31 19:16:07 MSK 2008


Привет,

Наблюдаю интересную картину - после релоада 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

Сборка nginx из портов
[root at host]# nginx -V
nginx version: nginx/0.7.19
configure arguments: --prefix=/usr/local/etc/nginx --with-cc-opt=-I /usr/local/include 
--with-ld-opt=-L /usr/local/lib --conf-path=/usr/local/etc/nginx/nginx.conf 
--sbin-path=/usr/local/sbin/nginx --pid-path=/var/run/nginx.pid 
--error-log-path=/var/log/nginx-error.log --user=www --group=www --with-debug 
--http-client-body-temp-path=/var/tmp/nginx/client_body_temp 
--http-proxy-temp-path=/var/tmp/nginx/proxy_temp 
--http-fastcgi-temp-path=/var/tmp/nginx/fastcgi_temp --http-log-path=/var/log/nginx-access.log 
--with-http_stub_status_module --with-mail --without-mail_imap_module --without-mail_pop3_module 
--without-mail_smtp_module





More information about the nginx-ru mailing list