Nginx load balancer is very slow

Hi all,
I installed graylog cluster with three nodes and use nginx to load balancer graylog web. I found it very slow to access via nginx proxy, but can access fastlly through each node url. I wonder if my nginx configuration is wrong, please help me.
nginx config:

server {
    listen       80;
    server_name  host.example;
    location / {
           proxy_set_header    Host $http_host;
           proxy_set_header    X-Forwarded-Host $host;
           proxy_set_header    X-Forwarded-Server $host;
           proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
           proxy_set_header    X-Graylog-Server-URL http://host.example/api;
           proxy_send_timeout 120s;
           proxy_read_timeout 120s;
           proxy_pass  http://graylog-web-cluster;
    }
}
upstream graylog-web-cluster {
    server server1:9000;
    server server2:9000;
    server server3:9000;
}

server.conf

rest_listen_uri = http://x.x.x.x:9000/api/
web_listen_uri = http://x.x.x.x:9000/

I found some nginx error logs:

2018/03/01 11:20:28 [warn] 39949#39949: *692 upstream server temporarily disabled while connecting to upstream, client: 172.30.14.23, server: server1, request: "GET /api/ HTTP/1.1", upstream: "http://server2:9000/api/", host: "server1", referrer: "http://server1/"
2018/03/01 11:20:28 [error] 39949#39949: *692 upstream timed out (110: Connection timed out) while connecting to upstream, client: 172.30.14.23, server: server1, request: "GET /api/ HTTP/1.1", upstream: "http://server2:9000/api/", host: "server1", referrer: "http://server1/"
2018/03/01 11:20:48 [warn] 39949#39949: *705 upstream server temporarily disabled while connecting to upstream, client: 172.30.14.23, server: server1, request: "GET /api/ HTTP/1.1", upstream: "http://server3:9000/api/", host: "server1", referrer: "http://server1/"
2018/03/01 11:20:48 [error] 39949#39949: *705 upstream timed out (110: Connection timed out) while connecting to upstream, client: 172.30.14.23, server: server1, request: "GET /api/ HTTP/1.1", upstream: "http://server3:9000/api/", host: "server1", referrer: "http://server1/"

Thank you.

@Shelin

you should check your DNS resolution. Other from that I can’t think of any other reason. But maybe someone else has an idea.

Thanks for your replay. I run cat /etc/resolv.conf in each graylog node, it displays same result. I have no idea.:sob:

did you check if all used hostnames used in the configuration are resolvable and if yes how fast that is?

I haven’t checked this yet, because I do not know how to check it. Is there any way to check it?
Thank you.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.