How nginx stream module reuse tcp connections?

Francis Daly francis at daoine.org
Sun Mar 7 11:49:11 UTC 2021


On Thu, Feb 25, 2021 at 09:31:36PM -0500, allenhe wrote:

Hi there,

> As we know there are some keepalive options in the nginx http modules to
> reuse tcp connections,

That is: the http protocol, which nginx speaks both as a server and as
a client, includes a facility to request that multiple requests can be
made on the same tcp connection.

> But are there corresponding options in the nginx stream module to achieve
> the same?

In general - no. You usually don't care about "stream", you care about
the specific protocol that you are using on top of the tcp-or-other
connection. And in general, nginx does not know the details of *that*
protocol.

In specific cases - maybe. What is the use case that you care about here?

> How nginx persist tcp connection with downstream?

It's a tcp connection. From ip:port to ip:port at time, and subsequent
packets refer to previous ones. The tcp connection stays active until
it gets closed - Reset or Fin, usually.

> How nginx persist tcp connection with upstream?

Same answer, unless you have a specific use-case that wants further
explanation, I think.

> What is the "session" meaning in the stream context?

Where do you see that term?

Possibly the context there, will provide the description?

I see http://nginx.org/en/docs/njs/reference.html#stream and
http://nginx.org/en/docs/stream/ngx_stream_upstream_module.html#var_upstream_session_time
and some mentions in
http://nginx.org/en/docs/stream/ngx_stream_proxy_module.html

Generally, they seem to refer to "what you would expect they refer to".

All of the exact what-nginx-does "documentation" is in the src/stream/
directory.

The more general "summary" docs are at the website links above.

If you can point at a piece of documentation that should describe what
you want but does not, that will be useful information to help someone
improve the documentation.

Cheers,

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list