My understand on disabled Nginx's proxy buffering is that the app server will wait the client to respond instead of Nginx, so I should see many open connections, but it's not the case in my testing.


client ( <===> Nginx ( <===> PythonApp (, port 8000)

500 slow connections initiated by the client slowhttptest -c 500 -H -g -o my_header_stats -i 10 -r 50 -t GET -u http://pythonapp.com -x 24 -p 3

Nginx Conf:

user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

    worker_connections 768;
    # multi_accept on;


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

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    # gzip on;
    upstream pythonapp

    proxy_buffering off;
        listen 80;
        proxy_buffering off;
        server_name pythonapp.com;

        location /
            proxy_buffering off;
            proxy_pass http://pythonapp;

    # include /etc/nginx/conf.d/*.conf;
    # include /etc/nginx/sites-enabled/*;

Can only see 1 open connection from Nginx Only 1 open connection

If I initiate slow connections from client to PythonApp server directly, I can see many open connections Setup:

client ( <===> PythonApp (, port 8000)

500 slow connections initiated by the client slowhttptest -c 500 -H -g -o my_header_stats -i 10 -r 50 -t GET -u -x 24 -p 3 enter image description here

My questions are

  1. Why my app server doesn't have many open connections after Nginx reverse-proxies it?
  2. If my setting is incorrect, can you provide explicit code & config example to set up the corresponding environment, so as to show the performance or throughput difference between enabled remote buffering and disabled remote buffering?

1 Answer 1


Finally, I figured out how to test the throughput difference of enabled/disabled proxy buffering. I think slowtest isn't a good tool to test it. I used wrk

My new set up:

Slow client ( \
                        Nginx ( <===> PythonApp (, port 8000)
Fast client (

You can reference this Digital Ocean guide to set up Flask app Python App:

from flask import Flask
app = Flask(__name__)

def hello():
    return "<h1 style='color:blue'>Hello There!</h1>"

def big_file():
    return "<h1 style='color:blue'>" + "Hello There!"*1000000 + "</h1>"

if __name__ == "__main__":

Slow client:

# modprobe ifb
# ip link set dev ifb0 up
# tc qdisc add dev eth0 ingress
# tc filter add dev eth0 parent ffff: \
protocol ip u32 match u32 0 0 flowid 1:1 action mirred egress redirect dev ifb0
# tc qdisc add dev ifb0 root netem delay 750ms

Run wrk test on fast & slow client:

Slow client:

# wrk -t4 -c10 -d30  http://pythonapp.com/big-file

Fast client:

# wrk -t2 -c100 -d10 http://pythonapp.com

It's a must for slow client to access /big-file path, which will return a fairly large response. If the response is smaller than proxy_buffer_size, the connection between Nginx and proxied server will be closed very quickly, and you cannot simulate the blocking.

Connections occupied by slow clients under no proxy_buffering in Nginx & throughput of fast clients: Connections occupied by slow clients

Throughput of fast clients when no proxy buffering Test Result of fast client for no proxy buffering

If there is proxy_buffering, you shall not see connections occupied by slow clients. You can run the commands for slow clients to download slow response first, then check the connections in Nginx. No occupied connections by slow clients

Throughput of fast clients when there is proxy buffering enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .