Nginx返回110连接超时
nginx错误日志
2013/08/14 01:06:25 [error] 29031#0: *19429255 connect() failed (110: Connection timed out) while connecting to upstream, client: ***.***.***.***, server: d.localhost.com, request: "GET /dashboard/d HTTP/1.1", upstream: "http://0.0.0.0:9000/dashboard/d", host: "d.localhost.com", referrer: "http://d.localhost.com/"
我使用nginx服务资源文件并减少播放负载但仍然出现此错误 试过增加了 proxy_connect_timeout,send_timeout,proxy_read_timeout但错误仍然存在 即使服务器负载很低,它也会引发这些错误
这会经常发生不同的请求
我的nginx配置是
upstream dWeb {
server 0.0.0.0:9000;
}
server {
listen 80;
client_max_body_size 50M;
server_name d.localhost.com;
root /home/web/d-web;
send_timeout 20;
location /
{
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
proxy_max_temp_file_size 0;
proxy_connect_timeout 10000;
send_timeout 10000;
proxy_read_timeout 10000;
keepalive_timeout 10000;
root /home/web/dsp-web/d-web-0.1.0;
autoindex on;
proxy_pass http://dWeb;
error_log /data/nginxlog/d.rd/error.log;
}
}
答案 0 :(得分:3)
实际问题是播放无法处理发送给它的所有请求以及最终连接超时
就像增加nginx中的工作者一样,我们必须增加线程池以提高并行性能
覆盖默认线程池以提高性能
默认配置
play {
akka {
event-handlers = ["akka.event.Logging$DefaultLogger","akka.event.slf4j.Slf4jEventHandler"]
loglevel = WARNING
actor {
default-dispatcher = {
fork-join-executor {
parallelism-factor = 1.0
parallelism-max = 24
}
}
}
}
}
parallelism-factor是每个可用核心要创建的线程数 把它增加到4 因为每个请求有很多读写操作
覆盖配置 并行因子= 4.0 parallelism-max = 24
这停止了110超时错误