# Nginx load balancer is very slow

**URL:** <https://community.graylog.org/t/nginx-load-balancer-is-very-slow/4396>\
**Category:** Graylog Central (peer support)\
**Created:** [March 1, 2018, 3:28am UTC](https://community.graylog.org/t/nginx-load-balancer-is-very-slow/4396 "2018-03-01T03:28:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shelin](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/shelin/32/1854_2.png) [@Shelin](https://community.graylog.org/u/Shelin)\
**Post date:** [March 1, 2018, 3:28am UTC](https://community.graylog.org/t/nginx-load-balancer-is-very-slow/4396/1 "2018-03-01T03:28:47Z")

</div>

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** :

```auto
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**

```auto
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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![jan](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/jan/32/11_2.png) [@jan](https://community.graylog.org/u/jan)\
**Post date:** [March 1, 2018, 8:12am UTC](https://community.graylog.org/t/nginx-load-balancer-is-very-slow/4396/2 "2018-03-01T08:12:00Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![Shelin](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/shelin/32/1854_2.png) [@Shelin](https://community.graylog.org/u/Shelin)\
**Post date:** [March 1, 2018, 8:22am UTC](https://community.graylog.org/t/nginx-load-balancer-is-very-slow/4396/3 "2018-03-01T08:22:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jan](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/jan/32/11_2.png) [@jan](https://community.graylog.org/u/jan)\
**Post date:** [March 1, 2018, 8:35am UTC](https://community.graylog.org/t/nginx-load-balancer-is-very-slow/4396/4 "2018-03-01T08:35:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Shelin](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/shelin/32/1854_2.png) [@Shelin](https://community.graylog.org/u/Shelin)\
**Post date:** [March 1, 2018, 8:43am UTC](https://community.graylog.org/t/nginx-load-balancer-is-very-slow/4396/5 "2018-03-01T08:43:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/3X/c/7/c7c09c6b5099570133d6502b83f50ba4430de5b6.png) [@system](https://community.graylog.org/u/system)\
**Post date:** [March 15, 2018, 8:44am UTC](https://community.graylog.org/t/nginx-load-balancer-is-very-slow/4396/6 "2018-03-15T08:44:06Z")

</div>

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