Using single persistent socket to send subrequests
Devashi Tandon
devashi.tandon at appsentinels.ai
Mon Jan 24 05:52:56 UTC 2022
Hi,
We have the following configuration:
location / {
proxy_http_version 1.1;
proxy_pass http://ext-authz-upstream-server;
}
upstream ext-authz-upstream-server {
server 172.20.10.6:9006;
keepalive 4;
}
With this configuration, as per the previous email in nginx-devel, I am expecting that when I sequentially send 5 requests the 5th request should reuse one of the ports of the first four requests since 4 socket connections should be cached and persistent. But I observe that the 5th connection is also sent from a new source port.
Do I need to add any other configuration to reuse the first four socket connections besides keepalive 4?
Looking forward to your response.
Thanks,
Devashi
________________________________
From: nginx-devel <nginx-devel-bounces at nginx.org> on behalf of Maxim Dounin <mdounin at mdounin.ru>
Sent: Thursday, December 30, 2021 1:47 PM
To: nginx-devel at nginx.org <nginx-devel at nginx.org>
Subject: Re: Using single persistent socket to send subrequests
Hello!
On Thu, Dec 30, 2021 at 07:58:33AM +0000, Devashi Tandon wrote:
> upstream ext-authz-upstream-server {
> server 172.20.10.6:9006;
> keepalive 4;
> }
[...]
> However, when I create 100 simultaneous connections, they are
> all sent via a different source port which means that a new
> socket connection is created everytime.
That's expected behaviour: the keepalive directive specifies the
number of connections to cache, not the limit on the number of
connections to the upstream server. With many simultaneous
requests nginx will open additional connections as needed.
> How can I pipeline requests over 4 connections with keepalive
> configuration set to 4?
You cannot, pipelining is not supported by the proxy module.
If the goal is not pipelining but to limit the number of
connections to upstream servers, the "server ... max_conns=..." and
the "queue" directive as available in nginx-plus might be what you
want, see here:
http://nginx.org/en/docs/http/ngx_http_upstream_module.html#max_conns
http://nginx.org/en/docs/http/ngx_http_upstream_module.html#queue
Note well that such questions do not look like something related
to nginx development. A better mailing list for user-level
question would be nginx at nginx.org, see here:
http://nginx.org/en/support.html
Hope this helps.
--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx-devel mailing list
nginx-devel at nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20220124/72472fce/attachment.htm>
More information about the nginx
mailing list