On 2024-Oct-07, KK CHN wrote:
> On Mon, Oct 7, 2024 at 12:07 AM Alvaro Herrera <alvherre@alvh.no-ip.org>
> wrote:
> Where do I have to introduce the TCP keepalives ? in the OS level or
> application code level ?
>
> [root@dbch wildfly-27.0.0.Final]# cat /proc/sys/net/ipv4/tcp_keepalive_time
> 7200
> [root@dbch wildfly-27.0.0.Final]# cat /proc/sys/net/ipv4/tcp_keepalive_intvl
> 75
> [root@dbch wildfly-27.0.0.Final]# cat
> /proc/sys/net/ipv4/tcp_keepalive_probes
> 9
> [root@dbch wildfly-27.0.0.Final]#
>
> These are the default values in the OS level. Do I need to reduce all the
> above three values to say 600, 20, 5 ? Or need to be handled in the
> application backend code ?
My understanding is that these values have no effect unless the socket
gets
setsockopt( ... , SO_KEEPALIVE, ...)
So that's definitely something that the app needs to do -- it's not
enabled automatically.
With these default settings, the connection would be closed about 2:11
after going quiet, so if your problem manifests only a week later, you
would have enough time for these to be cleaned up. But of course you
should monitor what happens.
> > I wonder if the connections from Wildfly to Postgres use SSL? Because
> > there are reported cases where TCP connections are kept and accumulate,
> > causing problems -- but apparently SSL is a necessary piece for that to
> > happen.
> >
> No SSL in between Wildfly (8080 ) to PGSQL(5432).
Okay, that's unlikely to be relevant then.
--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"Linux transformó mi computadora, de una `máquina para hacer cosas',
en un aparato realmente entretenido, sobre el cual cada día aprendo
algo nuevo" (Jaime Salinas)