110连接超时 – 使用play 2.1.3和nginx

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的资产文件和减less播放负载,但我仍然得到这个错误尝试增加proxy_connect_timeout,send_timeout,proxy_read_timeout但即使当服务器负载低错误仍然存​​在,它引发了这些错误

这经常发生不同的请求

和我的nginxconfiguration是

 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; } } 

实际的问题是播放无法处理所有发送到它的请求,并最终连接超时

像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 } } } } } 

并行性因素是每个可用内核创建的线程数增加到4个,因为每个请求有很多的读写操作

overridden configuration parallelism-factor = 4.0 parallelism-max = 24

这停止了​​110超时错误