Forum: NGINX upstream keepalive with upstream hash

Posted by beaufour (Guest)
on 2013-03-15 20:49
(Received via mailing list)
I've been trying to get this setup working:
client <- c0 -> nginx1 <- c1 -> nginx2 <- c2 -> service (http)

where the c1 connection is kept alive between request from from the 
outside,
but c0 and c2 are closed after each request. I've used the 'keepalive'
keyword in the upstream nginx1 config, and it works. Unfortunately I 
also
use the upstream hash patch on nginx1, and as soon as I enable that 
nginx1
closes the connection forcefully. I've confirmed this with tcpdump in 
both
setups, and it's the only difference. Any hints to what I can do?

I'm suspecting that the upstream hash module "takes over" the upstream
handling, and thus ignores the 'keepalive' keyword, but I'm randomly
guessing.

Thanks,

Allan

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,237417,237417#msg-237417
Posted by beaufour (Guest)
on 2013-03-15 21:11
(Received via mailing list)
I also just tried the ip_hash module and it also disables the keepalive
functionality :(

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,237417,237420#msg-237420
Posted by Maxim Dounin (Guest)
on 2013-03-17 00:14
(Received via mailing list)
Hello!

On Fri, Mar 15, 2013 at 03:48:56PM -0400, beaufour wrote:

> I'm suspecting that the upstream hash module "takes over" the upstream
> handling, and thus ignores the 'keepalive' keyword, but I'm randomly
> guessing.

Quoting http://nginx.org/r/keepalive:

: When using load balancer methods other than the default
: round-robin, it is necessary to activate them before the keepalive
: directive.

--
Maxim Dounin
http://nginx.org/en/donation.html
Posted by beaufour (Guest)
on 2013-03-18 14:53
(Received via mailing list)
Maxim Dounin Wrote:
> > I'm suspecting that the upstream hash module "takes over" the
> upstream
> > handling, and thus ignores the 'keepalive' keyword, but I'm randomly
> > guessing.
>
> Quoting http://nginx.org/r/keepalive:
>
> : When using load balancer methods other than the default
> : round-robin, it is necessary to activate them before the keepalive
> : directive.

Doh! That seems to do the trick. Thanks!

Allan

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,237417,237489#msg-237489
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.