Question

Nginx returns a 110 connection timed out

nginx error log

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/"

I served assets file with nginx and reduceded load on play but still i get this error have tried increasing the proxy_connect_timeout , send_timeout , proxy_read_timeout but the error persists even when the servers load is low it throws up these errors

this happens regularly with different requests

and my nginx configuration is

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;
}
}
Was it helpful?

Solution

the actual problem was play was not able to handle all the requests that where sent to it and the connection timed out eventually

like increasing workers in nginx in play we have to increase thread pools to improve parallel performance

overriding the default thread pool to increase performance

default configuration

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

the parallelism-factor is number of threads to be created per available core increasing it to 4 since there is a lot of read and write operations per request

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

this stopped the 110 time out error

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top