Postgres keep alive configuration

From: Fabrice Chapuis <fabrice636861(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Postgres keep alive configuration
Date: 2025-07-23 11:20:52
Message-ID: CAA5-nLCvx449=jBrWkPWSnvxPEboJzo2iLdgf9j77o42OcD-fg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I try to configure these 3 parameters to activate keep alive on a sever
Postgres in version 14.

tcp_keepalives_idle = 3
tcp_keepalives_interval = 2
tcp_keepalives_count = 30

After issuing alter system set ... command and a pg_reload_conf(); these
parameters keep value 0.

I also check these OS parameters
grep TCP_KEEPIDLE /usr/include/netinet/tcp.h
#define TCP_KEEPIDLE 4 /* Start keeplives after this period */

grep TCP_KEEPINTVL /usr/include/netinet/tcp.h
#define TCP_KEEPINTVL 5 /* Interval between keepalives */

grep TCP_KEEPCNT /usr/include/netinet/tcp.h
#define TCP_KEEPCNT 6 /* Number of keepalives before death */

and

sysctl net.ipv4.tcp_keepalive_time
net.ipv4.tcp_keepalive_time = 7200

Thanks for helping on this point

Fabrice

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Westermann (DWE) 2025-07-23 11:30:54 Re: Postgres keep alive configuration
Previous Message Ilia Evdokimov 2025-07-23 11:07:56 Re: Add estimated hit ratio to Memoize in EXPLAIN to explain cost adjustment