Now issue is if the request comes to nginx when one server is down
due to unknown reasons its waiting for a long time getting response or
some times its getting connection timeout.
Is there any module in nginx to get upstream servers status and forward
requests only working upstream server.
Can someone suggest me right configuration to get response from
appcluster without latency or connection time out whenever a server wont
respond.
@Parikh I tried with proxy_next_upstream also but facing same issue.
Regarding fail_timeout I used values from 10s to 30s but facing same
issue.
I used following configuration, just check and let me know If I am
missing any thing.
upstream appcluster { server host1.example.com:8080 max_fails=2
fail_timeout=10s; server host2.example.com:8080 max_fails=2
fail_timeout=10s;}
i’d suggest you’ll start with low-level-debugging:
goto host1 and make a tcpdump port 8080 / tail -f against access-logs
of that server;
make a request
check., what happens to that request, e.g. where it “hangs”
you could also, just in case, make a “tcpdump port 808 and host host2”
onm
your nginx, just to make sure that nginx is sending the requests to the
right server
I have 2 upstream servers host1 and host2.
host1 is up and running and listening on port 8080host2 is powered off.
When I sent a request to nginx, I received response after 2 minutes.
Until 2 minutes the request is waiting.
Thanks,Sandeep.
Hi,
After experimenting with some parameters I used following configuration.
upstream appcluster { server host1.example.com:8080 max_fails=1 fail_timeout=1s;
server host2.example.com:8080 max_fails=1 fail_timeout=1s; }
server { listen *; location / {
proxy_pass http://appcluster;
proxy_next_upstream error timeout http_404 http_500 http_502 http_503
http_504; proxy_set_header X-Real-IP
$remote_addr; proxy_connect_timeout 2;
proxy_send_timeout 2; proxy_read_timeout
5; } }
The issue I am facing here is - with similar configuration in lighttpd
response time per request 0.3 seconds, where as with nginx it is around
2.5 seconds.
Can someone suggest me how to response time with nginx?
Thanks,Sandeep.