【问题标题】:Nginx / FastCGI crashing on me all the timeNginx / FastCGI 一直在我身上崩溃
【发布时间】:2012-02-08 08:49:11
【问题描述】:

有没有 Nginx / FastCGI 大师可以帮助我?

我在服务 Mono FastCGI (fastcgi-mono-server4 2.10.2.0) 的 Debian Squeeze 上运行 nginx 1.0.11。我注意到 FastCGI 实例在响应超过 ~350,000 字节的 POST 请求时经常崩溃。尽管这种规模的一些请求是成功的,但随着流量的增加,它们更有可能失败。此外,通常当 FastCGI 实例失败时,Nginx 工作进程将被僵尸化(即 Nginx 仍然处理请求但超时 - 尽管所有网关都可能关闭,但没有返回 502)。我打开了 Nginx 调试,并在工作进程和 FastCGI 实例崩溃之前注意到以下内容。

2012/01/11 20:38:42 [debug] 1744#0: *141 writev: 8
2012/01/11 20:38:42 [debug] 1744#0: *141 sendfile: @360448 32768
2012/01/11 20:38:42 [debug] 1744#0: *141 sendfile: 32768, @360448 32768:32768
2012/01/11 20:38:42 [debug] 1744#0: *141 writev: 8
2012/01/11 20:38:42 [debug] 1744#0: *141 sendfile: @393216 12167
2012/01/11 20:38:42 [debug] 1744#0: *141 sendfile: 12167, @393216 12167:12167
2012/01/11 20:38:42 [debug] 1744#0: *141 writev: 9
2012/01/11 20:38:42 [debug] 1744#0: *141 chain writer out: 0000000000000000
2012/01/11 20:38:42 [debug] 1744#0: *141 event timer del: 16: 1326314382071
2012/01/11 20:38:42 [debug] 1744#0: *141 event timer add: 16: 60000:1326314382072

这些只是最近记录的 10 个项目,但是,如果您想查看更多,我当然可以发布或 PM。最后,这是我的 Nginx 配置文件。

user                 www-data;
worker_processes     2;
worker_rlimit_nofile 8192;
events {
    worker_connections  2048;
    use                 epoll;
}

http {
    error_log               /var/log/error.log;
    include                 mime.types;
    default_type            application/octet-stream;           
    sendfile                on;
    keepalive_timeout       65;

    gzip              on;
    gzip_http_version 1.1;
    gzip_vary         on;
    gzip_comp_level   6;
    gzip_proxied      any;
    gzip_types        text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript text/x-js font/opentype application/font-woff;
    gzip_buffers      16 8k;
    gzip_disable      "MSIE [1-6]\.(?!.*SV1)";

    upstream backend {
        server 127.0.0.1:8080;
        server 127.0.0.1:8081;
    }

    server {
        listen       80;
        server_name  my_server;
        root         /var/www;
        access_log   /var/log/host.access.log;

        location / {
            fastcgi_param            SCRIPT_FILENAME /scripts$fastcgi_script_name;
            include                  fastcgi_params;
            fastcgi_pass             backend;
            fastcgi_next_upstream    http_500 http_404 error timeout;
            fastcgi_read_timeout     60;
        }

        location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|html|htm)$ {
            root /var/www;
        }
    }
}

【问题讨论】:

  • 错误日志报告我的工作进程已在信号 9 上退出。有人熟悉信号 9 吗?这可能意味着什么?

标签: mono nginx fastcgi


【解决方案1】:

原来 Mono 的 LOH 和缺乏碎片整理是问题所在。所以这里的解决方案是在问题上投入更多的内存。

http://blog.mohammadjalloul.com/blogs/mo/archive/2010/02/21/the-large-object-heap.aspx

【讨论】:

    猜你喜欢
    • 2016-03-22
    • 1970-01-01
    • 1970-01-01
    • 2011-10-23
    • 1970-01-01
    • 2011-07-24
    • 1970-01-01
    • 1970-01-01
    • 2011-08-24
    相关资源
    最近更新 更多