nginx reverse proxy slows down my throughput by half

Posted by Isaac A Mosquera on Server Fault See other posts from Server Fault or by Isaac A Mosquera
Published on 2012-08-29T15:11:09Z Indexed on 2012/08/29 15:40 UTC
Read the original article Hit count: 155

Filed under:
|

I'm currently using nginx to proxy back to gunicorn with 8 workers. I'm using an amazon extra large instance with 4 virtual cores. When I connect to gunicorn directly I get about 10K requests/sec. When I serve a static file from nginx I get about 25 requests/sec.

But when I place gunicorn behind nginx on the same physical server I get about 5K requests/sec. I understand there will be some latency from nginx, but I think there might be a problem since it's a 50% drops. Anybody heard of something similar? any help would be great!

Here is the relevant nginx conf:

worker_processes 4;
worker_rlimit_nofile 30000;

events {
worker_connections 5120;
}

http {

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;

}

sites-enabled/default:

upstream backend {
server 127.0.0.1:8000;
}

server {
server_name api.domain.com ;

location / {
proxy_pass http://backend;
proxy_buffering off;
}
}

© Server Fault or respective owner

Related posts about nginx

Related posts about proxy