Discussion:
so_reuseport and HttpClientConnection
M.P. Ardhanareeswaran
2018-07-23 03:46:02 UTC
Permalink
All:

In NGINX (and Apache HTTP server) multiple workers can be bound to a port. For example, multiple workers can be bound to say localhost:80 using the SO_REUSEPORT feature. When requesting a connection from the pool, is it possible to get a connection to a certain worker? There can be information cached in a certain worker and the application may want to connect to it.

With regards,
M.P. Ardhanareeswaran
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-***@hc.apache.org
For additional commands, e-mail: httpclient-users-***@hc.apache.org
Bernd Eckenfels
2018-07-23 11:18:01 UTC
Permalink
Hello,

I am pretty sure there is no way to connect to a specific listener. However I am also pretty sure you would have to ask Httpd or Nginx projects instead.

However I am also sure that you normally don’t need it, must of the caches are shared across all the workers (or sessions beeing sticky). Can you give a specific case where this is not the case?

Gruss
Bernd
--
http://bernd.eckenfels.net

________________________________
Von: M.P. Ardhanareeswaran <***@oracle.com>
Gesendet: Montag, Juli 23, 2018 5:46 AM
An: httpclient-***@hc.apache.org
Betreff: so_reuseport and HttpClientConnection

All:

In NGINX (and Apache HTTP server) multiple workers can be bound to a port. For example, multiple workers can be bound to say localhost:80 using the SO_REUSEPORT feature. When requesting a connection from the pool, is it possible to get a connection to a certain worker? There can be information cached in a certain worker and the application may want to connect to it.

With regards,
M.P. Ardhanareeswaran
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-***@hc.apache.org
For additional commands, e-mail: httpclient-users-***@hc.apache.org
M.P. Ardhanareeswaran
2018-07-23 13:53:36 UTC
Permalink
Bernd:

I have a use case in which the client wants to perform a transaction that uses a database connection. The database connection is associated with a worker. The client has the URI to the database connection but the client’s GET/POST etc. have to be routed to the correct worker/child. Cache doesn’t figure in this design.

Something like this seems to be possible with reverse proxies. In my case, I am considering a handler/module. It may be a server side question. It may be that I’ve to play with the URI for routing. IDK yet.

HttpRoute in the direct mode is driven by host/port. With SO_REUSEPORT, it almost seems like I need the remote port to distinguish/check out a connection from the pool manager. Or I’ve to solve the problem in a different way on the server side.

With regards,
M.P. Ardhanareeswaran
Post by Bernd Eckenfels
Hello,
I am pretty sure there is no way to connect to a specific listener. However I am also pretty sure you would have to ask Httpd or Nginx projects instead.
However I am also sure that you normally don’t need it, must of the caches are shared across all the workers (or sessions beeing sticky). Can you give a specific case where this is not the case?
Gruss
Bernd
--
https://urldefense.proofpoint.com/v2/url?u=http-3A__bernd.eckenfels.net&d=DwIF-g&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=c0nJ6OcgTgcBV2N1F7_XcSoSai9fe2ao0-El70rew7s&m=_-B4HIu_hQyCQd8z8kvBCEfX3LBA1Fb9uacKNZhqK6s&s=FEQZ8TAnu2wbSSon8V4j_NcA44luiG33Dqdop6n4NNw&e=
________________________________
Gesendet: Montag, Juli 23, 2018 5:46 AM
Betreff: so_reuseport and HttpClientConnection
In NGINX (and Apache HTTP server) multiple workers can be bound to a port. For example, multiple workers can be bound to say localhost:80 using the SO_REUSEPORT feature. When requesting a connection from the pool, is it possible to get a connection to a certain worker? There can be information cached in a certain worker and the application may want to connect to it.
With regards,
M.P. Ardhanareeswaran
---------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-***@hc.apache.org
For additional commands, e-mail: httpclient-users-***@hc.apache.org
Bernd Eckenfels
2018-07-23 14:02:51 UTC
Permalink
Hello,

It is generally not a good idea to keep a database transaction open over multiple requests, if you need that you would need to bind the connection object to the session (which is I guess not easily possible in CGI or native code).

Those kinds of session questions are best asked in the matching projects (PHP?), not sure if PHP would allow that.

Gruß
Bernd

--
https://Bernd.eckenfels.net

________________________________
Von: M.P. Ardhanareeswaran <***@oracle.com>
Gesendet: Montag, Juli 23, 2018 3:53 PM
An: HttpClient User Discussion
Betreff: Re: so_reuseport and HttpClientConnection

Bernd:

I have a use case in which the client wants to perform a transaction that uses a database connection. The database connection is associated with a worker. The client has the URI to the database connection but the client’s GET/POST etc. have to be routed to the correct worker/child. Cache doesn’t figure in this design.

Something like this seems to be possible with reverse proxies. In my case, I am considering a handler/module. It may be a server side question. It may be that I’ve to play with the URI for routing. IDK yet.

HttpRoute in the direct mode is driven by host/port. With SO_REUSEPORT, it almost seems like I need the remote port to distinguish/check out a connection from the pool manager. Or I’ve to solve the problem in a different way on the server side.

With regards,
M.P. Ardhanareeswaran
Post by Bernd Eckenfels
Hello,
I am pretty sure there is no way to connect to a specific listener. However I am also pretty sure you would have to ask Httpd or Nginx projects instead.
However I am also sure that you normally don’t need it, must of the caches are shared across all the workers (or sessions beeing sticky). Can you give a specific case where this is not the case?
Gruss
Bernd
--
https://urldefense.proofpoint.com/v2/url?u=http-3A__bernd.eckenfels.net&d=DwIF-g&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=c0nJ6OcgTgcBV2N1F7_XcSoSai9fe2ao0-El70rew7s&m=_-B4HIu_hQyCQd8z8kvBCEfX3LBA1Fb9uacKNZhqK6s&s=FEQZ8TAnu2wbSSon8V4j_NcA44luiG33Dqdop6n4NNw&e=
________________________________
Gesendet: Montag, Juli 23, 2018 5:46 AM
Betreff: so_reuseport and HttpClientConnection
In NGINX (and Apache HTTP server) multiple workers can be bound to a port. For example, multiple workers can be bound to say localhost:80 using the SO_REUSEPORT feature. When requesting a connection from the pool, is it possible to get a connection to a certain worker? There can be information cached in a certain worker and the application may want to connect to it.
With regards,
M.P. Ardhanareeswaran
---------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-***@hc.apache.org
For additional commands, e-mail: httpclient-users-***@hc.apache.org
M.P. Ardhanareeswaran
2018-07-23 14:58:11 UTC
Permalink
Bernd:

Database clients can keep a connection open and send multiple requests. This is commonly done in TCP/IP based, non-HTTP, proprietary protocols. If they want to optimize, they write server side procedures and invoke them in one request.

I can limit the workers to 1. This will “solve” the issue. I did something like that in Go. I was investigating how well this will port to Apache httpd or NGINX.

Another possibility is to lease the connection connected to a worker forever or have some custom manager that uses HttpRoute and remote port as the key to return a connection.

I will post in NGINX/httpd mailing list.

With regards,
M.P. Ardhanareeswaran
Post by Bernd Eckenfels
Hello,
It is generally not a good idea to keep a database transaction open over multiple requests, if you need that you would need to bind the connection object to the session (which is I guess not easily possible in CGI or native code).
Those kinds of session questions are best asked in the matching projects (PHP?), not sure if PHP would allow that.
Gruß
Bernd
--
https://urldefense.proofpoint.com/v2/url?u=https-3A__Bernd.eckenfels.net&d=DwIF-g&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=c0nJ6OcgTgcBV2N1F7_XcSoSai9fe2ao0-El70rew7s&m=Jz2UluQ4bTl0nrRa5zz5UXhqcNp0jSRrRhYSOSVQcqQ&s=98kAqMBOmfgEP6ASxFdkJeskiaA3QgpNvj4Vf0j2hm8&e=
________________________________
Gesendet: Montag, Juli 23, 2018 3:53 PM
An: HttpClient User Discussion
Betreff: Re: so_reuseport and HttpClientConnection
I have a use case in which the client wants to perform a transaction that uses a database connection. The database connection is associated with a worker. The client has the URI to the database connection but the client’s GET/POST etc. have to be routed to the correct worker/child. Cache doesn’t figure in this design.
Something like this seems to be possible with reverse proxies. In my case, I am considering a handler/module. It may be a server side question. It may be that I’ve to play with the URI for routing. IDK yet.
HttpRoute in the direct mode is driven by host/port. With SO_REUSEPORT, it almost seems like I need the remote port to distinguish/check out a connection from the pool manager. Or I’ve to solve the problem in a different way on the server side.
With regards,
M.P. Ardhanareeswaran
Post by Bernd Eckenfels
Hello,
I am pretty sure there is no way to connect to a specific listener. However I am also pretty sure you would have to ask Httpd or Nginx projects instead.
However I am also sure that you normally don’t need it, must of the caches are shared across all the workers (or sessions beeing sticky). Can you give a specific case where this is not the case?
Gruss
Bernd
--
https://urldefense.proofpoint.com/v2/url?u=http-3A__bernd.eckenfels.net&d=DwIF-g&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=c0nJ6OcgTgcBV2N1F7_XcSoSai9fe2ao0-El70rew7s&m=_-B4HIu_hQyCQd8z8kvBCEfX3LBA1Fb9uacKNZhqK6s&s=FEQZ8TAnu2wbSSon8V4j_NcA44luiG33Dqdop6n4NNw&e=
________________________________
Gesendet: Montag, Juli 23, 2018 5:46 AM
Betreff: so_reuseport and HttpClientConnection
In NGINX (and Apache HTTP server) multiple workers can be bound to a port. For example, multiple workers can be bound to say localhost:80 using the SO_REUSEPORT feature. When requesting a connection from the pool, is it possible to get a connection to a certain worker? There can be information cached in a certain worker and the application may want to connect to it.
With regards,
M.P. Ardhanareeswaran
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-***@hc.apache.org
For additional commands, e-mail: httpclient-users-***@hc.apache.org
Loading...