UDP load balancing and ephemeral ports

Maxim Dounin mdounin at mdounin.ru
Tue Jul 17 12:40:49 UTC 2018


On Mon, Jul 16, 2018 at 08:27:07PM -0400, bwmetcalf at gmail.com wrote:

> A couple of questions regarding UDP load balancing.  If a UDP listener is
> configured to expect a response from its upstream nodes, is it possible to
> have another IP outside of the pool of upstream nodes send a response to the
> ephemeral port where nginx is expecting a response?  I'm pretty sure the
> answer is no and the response has to come from the IP where the request was
> forwarded, but wanting to verify.  We have a use case where another part of
> our backend system could possibly send that response if coded to do so, but
> I'm pretty sure this simply will not work.

You are right, this won't work.

> Secondly, how long will nginx keep the ephemeral port open waiting for a
> response from the upstream node where the request is sent and is this
> configurable?   It looks like proxy_responses might be helpful in quickly
> terminating a session after the desired number of responses are received?

The port is closed either on proxy_timeout, or per 
proxy_responses.  Details can be found here:


Maxim Dounin

More information about the nginx mailing list