【问题标题】:nginx + uWSGI + Django crashes with benchmarking tool wrknginx + uWSGI + Django 使用基准测试工具 wrk 崩溃
【发布时间】:2016-01-28 12:42:26
【问题描述】:

我已经为我的 Django 应用程序配置了 nginx、uWSGI 服务器。一切似乎都很好,当我使用 wrk 执行一些请求时,nginx 服务器会立即开始响应 502 Bad Gateway(我认为 uWSGI 崩溃)。当我停止 wrk 时,一切都开始正常工作。是否有一些限制,在一定时间内可以发出多少个请求或其他什么?这是一个非常糟糕的问题,因为如果很多用户使用它,系统就会崩溃。

我的 uWSGI 配置:

[uwsgi]

base         = /home/user/
project      = app
home         = %(base)/env
module       = %(project).wsgi:application

master       = true
processes    = 5

socket       = /var/sockets/app.sock
chmod-socket = 664
uid          = www-data
gid          = www-data

harakiri     = 600
vacuum       = true

die-on-term  = true

我的 nginx 配置:

server {
    listen      8000;
    server_name 127.0.0.1;
    charset     utf-8;

    location /media  {
        alias /home/user/app/media;
    }

    location /static {
        alias /home/user/app/static;
    }

    location / {
        uwsgi_pass         unix:/var/sockets/app.sock;
        uwsgi_read_timeout 600;
        include            /home/user/app/uwsgi_params;
    }
}

【问题讨论】:

    标签: python django nginx uwsgi wrk


    【解决方案1】:

    Someone with a similar problem 被赋予the solution

    这应该可以解决它...

    你有:fastcgi_buffers 4 256k;

    改成:fastcgi_buffers 256 16k; // 4096k total

    同时设置fastcgi_max_temp_file_size 0,这将禁用缓冲 如果回复开始超出您的 fastcgi 缓冲区,则写入磁盘。

    你试过了吗?

    【讨论】:

      猜你喜欢
      • 2018-06-27
      • 2020-07-04
      • 2018-02-15
      • 2018-02-01
      • 2014-04-24
      • 2010-09-20
      • 2011-07-18
      • 1970-01-01
      • 2013-08-17
      相关资源
      最近更新 更多