nginx зависает

Артем Паньков artem на pankov.biz
Чт Ноя 25 10:23:38 MSK 2010


Система Centos 5.4
Раз в двое суток на проекте с посещаемостью 50000 просмотров в сутки
зависает nginx. LA = 2.00(ровно и не меняется, nginx занимает ровно 100%
процессора), вроде никакого особого статуса в топе нет
 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
19496 nginx     25   0 77744 3252  848 R 100.2  0.1 481:38.24 nginx


17412 nginx     25   0 77336 2980  856 R 99.6  0.0 481:38.54 nginx


    1 root      15   0 10344  728  612 S  0.0  0.0   0:00.92 init


 1776 apache    16   0  575m  49m  24m S  0.0  0.8   3:04.40 httpd


 1783 apache    16   0  577m  48m  23m S  0.0  0.8   3:04.66 httpd


 1868 root      15   0 60524 1176  628 S  0.0  0.0   0:06.61 sshd


 1876 root      18   0  6048  640  456 S  0.0  0.0   0:01.14 dovecot


 1885 root      15   0 64112 2908 1824 S  0.0  0.0   0:01.59 dovecot-auth


 1890 exim      15   0 80756 1476  720 S  0.0  0.0   0:00.07 exim


 1899 nobody    15   0 51520 2212 1216 S  0.0  0.0   0:00.15 proftpd


 1937 root      15   0 19708 1140  568 S  0.0  0.0   0:00.12 crond


 1953 root      15   0 59716 5768 1480 S  0.0  0.1   4:10.66 xbt_tracker


 1962 dovecot   18   0 33856 2196 1736 S  0.0  0.0   0:00.31 imap-login


 1963 dovecot   18   0 33856 2196 1736 S  0.0  0.0   0:00.30 imap-login


 1964 dovecot   18   0 33856 2196 1736 S  0.0  0.0   0:00.28 imap-login


 3669 dovecot   18   0 33852 2184 1724 S  0.0  0.0   0:00.04 pop3-login


 3685 dovecot   18   0 33852 2180 1724 S  0.0  0.0   0:00.04 pop3-login


 3700 dovecot   18   0 33852 2184 1724 S  0.0  0.0   0:00.04 pop3-login


 5192 apache    16   0  681m 131m  24m S  0.0  2.2   9:44.84 httpd


 9757 apache    15   0  574m  44m  22m S  0.0  0.7   1:49.64 httpd


После, что сообщает debug.log в момент зависания:
2010/11/25 01:46:39 [notice] 16259#0: signal 17 (SIGCHLD) received
2010/11/25 01:46:39 [alert] 16259#0: worker process 17411 exited on signal
11
2010/11/25 01:46:39 [notice] 16259#0: start worker process 19496
2010/11/25 01:46:39 [notice] 16259#0: signal 29 (SIGIO) received
2010/11/25 04:39:01 [notice] 16259#0: signal 10 (SIGUSR1) received,
reopening logs
2010/11/25 04:39:01 [notice] 16259#0: reopening logs

Судя по логам апача - последний проксированный запрос пришел в 01:46:39.

Данное поведение на сервере начала появляться недавно. Похоже, после
включения кэширования анонимов.

worker_processes  1;

error_log /var/log/nginx/error.log debug;
#error_log  /usr/local/nginx/logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    log_format  main  '$upstream_cache_status $body_bytes_sent $status $uri
$remote_addr';

    access_log  /usr/local/nginx/logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    gzip  on;
    gzip_comp_level 9;

    proxy_cache_path /usr/local/nginx/cache levels=1:2 keys_zone=test:20m
inactive=20m;

    server {
        listen       x.x.x.x:80;
        server_name     test.org www.test.org test.ru www.test.ru;
        server_name_in_redirect  off;

        location / {
         proxy_pass         http://127.0.0.1:80/;
         proxy_set_header   Host             $host;
         proxy_set_header   X-Real-IP        $remote_addr;
#no         proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        proxy_set_header  X-Forwarded-For       $remote_addr;

        proxy_cache     test;
        proxy_cache_key $host$uri?$args;
        proxy_no_cache $cookie_logged;
        proxy_cache_bypass $cookie_logged;
        proxy_cache_use_stale error timeout invalid_header http_500 http_502
http_503 http_504;

        proxy_pass_header Set-Cookie;
        proxy_ignore_headers "Expires" "Cache-Control";

        proxy_cache_valid 200 301 302 304 1h;
         client_max_body_size       16m;
         client_body_buffer_size    128k;
         proxy_connect_timeout      30;
         proxy_send_timeout         30;
         proxy_read_timeout         30;
#         proxy_connect_timeout      3000000;
#         proxy_send_timeout         3000000;
#         proxy_read_timeout         3000000;
         proxy_buffer_size          8k;
         proxy_buffers              8 8k;
         proxy_busy_buffers_size    32k;
         proxy_temp_file_write_size 10m;

     }


        location ~* /sites/all/files/imagecache/ {
            root /var/www/html;
            error_page 404 = @backend;
        }

        location @backend {
            proxy_pass http://127.0.0.1;
            proxy_redirect off;

            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $remote_addr;
        }

    }

}


*куда копать?*
-- 
С уважением,
Паньков Артем Владимирович.
ICQ: 842264
Мобильный: +7 903 726 19 69
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx-ru/attachments/20101125/aab0366f/attachment-0001.html>


Подробная информация о списке рассылки nginx-ru