Welcome! Log In Create A New Profile

Advanced

Proxy non persistent client connections to persistent upstream connections

Richard Jennings
August 10, 2015 04:20AM
I would like to be able to proxy non persistent client http connections to
persistent upstream connections on a Linux system, both to reduce the
number of connections and the upstream latency.

I have experimented with keepalive and proxy_pass.

To observe performance I used log_format upstreamlog '[$time_local] $status
$connection $connection_requests $request_time'; and $ lsof -Pni

What I think I have found is that some of the time persistent upstream
connections are reused, but very often they are not. I believe the
occasions where upstream connections are reused are possible because by
chance the client connection has been reused.

Is there a way to make this work?

Regards

Example configuration

log_format upstreamlog '[$time_local] $status $connection
$connection_requests $request_time';

upstream google {
server google.com:80;
keepalive 10;
}

upstream yahoo {
server yahoo.com:80
keepalive 10;
}

server {
listen 8080;
server_name 10.0.0.1;
proxy_connect_timeout 500ms;
proxy_send_timeout 500ms;
proxy_read_timeout 500ms;
send_timeout 500ms;

location /status {
stub_status on;
}

location /google {
proxy_pass http://www.google.com;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host google.com;
access_log /var/log/google.log upstreamlog;
}

location /yahoo {
proxy_pass http://www.yahoo.com;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host yahoo.com;
access_log /var/log/yahoo.log upstreamlog;
}
}
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Proxy non persistent client connections to persistent upstream connections

Richard Jennings August 10, 2015 04:20AM

Re: Proxy non persistent client connections to persistent upstream connections

Maxim Dounin August 11, 2015 08:36AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 152
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready