Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js Socket.IO+;Nginx连接限制_Node.js_Sockets_Nginx_Socket.io - Fatal编程技术网

Node.js Socket.IO+;Nginx连接限制

Node.js Socket.IO+;Nginx连接限制,node.js,sockets,nginx,socket.io,Node.js,Sockets,Nginx,Socket.io,我使用Nginx启动服务器并将其用作负载平衡。 现在我尝试加载测试服务器 我循环创建连接并计算有多少连接connect,并在connect\u出错时记录。 当我通过Nginx连接到服务器时,每次约500次连接后都会出现错误 Opening SOCKET SOCKET connect 508 Opening SOCKET SOCKET connect 509 Opening SOCKET connect_error { [Error: websocket error] descri

我使用Nginx启动服务器并将其用作负载平衡。 现在我尝试加载测试服务器

我循环创建连接并计算有多少连接
connect
,并在
connect\u出错时记录。
当我通过Nginx连接到服务器时,每次约500次连接后都会出现错误

Opening SOCKET
   SOCKET connect 508
Opening SOCKET
   SOCKET connect 509
Opening SOCKET
connect_error
{ [Error: websocket error]
  description: 
     { [Error: socket hang up]
       code: 'ECONNRESET',
       target: 
          { domain: null,
            _events: [Object],
            _maxListeners: 10,
            _socket: null,
            _ultron: null,
            _closeReceived: false,
            bytesReceived: 0,
            readyState: 0,
            supports: [Object],
            extensions: {},
            _isServer: false,
            url: 'ws://MY_NGINX_SERVER/socket.io/?EIO=3&transport=websocket',
            protocolVersion: 13,
            binaryType: 'arraybuffer' } 
    } 
}
但若我直接连接到套接字服务器,它可以有500多个连接

这是我的Nginx配置

server {
    listen   80;
    access_log /var/log/nginx/load_test.log;
    location / {
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;
        proxy_pass http://SOCKETIO_SERVER/;
        proxy_redirect off;
    }
}
我认为这是Nginx配置文件中的内容,但我找不到任何帮助


感谢您的帮助。

我的坏消息,它必须在/etc/nginx/nginx.conf文件中配置
worker\u连接

events {
   worker_connections  60000;
}

我的问题是,它必须在/etc/nginx/nginx.conf文件中配置
worker\u连接

events {
   worker_connections  60000;
}

我的问题是,它必须在/etc/nginx/nginx.conf文件中配置
worker\u连接

events {
   worker_connections  60000;
}

我的问题是,它必须在/etc/nginx/nginx.conf文件中配置
worker\u连接

events {
   worker_connections  60000;
}

尝试增加最大打开文件限制(ulimit)。我将ulimit-n设置为500000。尝试增加最大打开文件限制(ulimit)。我将ulimit-n设置为500000。尝试增加最大打开文件限制(ulimit)。我将ulimit-n设置为500000。