# How to reduce the latency overheads of Nginx as load balancer

**URL:** <https://www.ruby-forum.com/t/how-to-reduce-the-latency-overheads-of-nginx-as-load-balancer/193002>\
**Category:** NGINX\
**Created:** [August 9, 2010, 9:52pm UTC](https://www.ruby-forum.com/t/how-to-reduce-the-latency-overheads-of-nginx-as-load-balancer/193002 "2010-08-09T21:52:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bjbjbj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/858c86/32.png) [@bjbjbj](https://www.ruby-forum.com/u/bjbjbj)\
**Post date:** [August 9, 2010, 9:52pm UTC](https://www.ruby-forum.com/t/how-to-reduce-the-latency-overheads-of-nginx-as-load-balancer/193002/1 "2010-08-09T21:52:00Z")

</div>

Hello,

I am using Nginx as my load balancer to Apache backend servers. It works  
great.

But I experienced a significant latency overhead Nginx load balancer  
added under heavy loaded traffics. I noticed that the response time  
increased from 1.5 sec to 3.0 sec, when compared with the case that no  
Nginx is used.

Do you have any suggestions on how I should configure Nginx to reduce  
such latency overheads?  
My Nginx configuration is attached below for your info.

Thanks,  
Chang

# ========================================== My Nginx configuration file

worker\_rlimit\_nofile 65536;  
worker\_processes 4;

events {  
worker\_connections 8182;  
use epoll;  
}  
http {  
server\_names\_hash\_bucket\_size 64;  
include /usr/local/nginx/conf/mime.types;  
default\_type application/octet-stream;  
sendfile on;  
tcp\_nopush on;  
keepalive\_timeout 65;  
tcp\_nodelay on;  
fastcgi\_read\_timeout 180;  
gzip on;  
gzip\_min\_length 1100;  
gzip\_buffers 4 8k;  
gzip\_types text/plain;  
upstream backend\_10\_1{  
server 192.168.2.110:80; server 192.168.2.111:80; server  
192.168.2.112:80;  
}

```
server {
    server_name default;
    listen 10.20.131.14;
    error_log /dev/null crit;
    access_log off;
    rewrite_log off;
    location / {
        proxy_pass http://backend_10_1;
        proxy_redirect off;
        proxy_buffering off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For

```

$proxy\_add\_x\_forwarded\_for;  
}  
}  
}

Posted at Nginx Forum:

> **[How to reduce the latency overheads of Nginx as load balancer](https://forum.nginx.org/read.php?2,117965,117965#msg-117965)**
>
> Hello, I am using Nginx as my load balancer to Apache backend servers. It works great. But I experienced a significant latency overhead Nginx load balancer added under heavy loaded traffics. I noticed that the response time increased from 1.5 sec to...
