keepalives_* parameters usefullness

From: "Jaime Casanova" <jaime(at)2ndquadrant(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: keepalives_* parameters usefullness
Date: 2011-07-04 08:42:43
Message-ID: 87wrfya130.fsf@casanova1.SEINGALT
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hi,

AFAIU TFM if i set keepalives_* parameters in a conninfo they set the
internal counters to these values so if i execute:

"""
conn = PQconnectdb("host=192.168.204.10 keepalives=1 keepalives_idle=45 keepalives_interval=5 keepalives_count=5");
"""

that means that the client's connection to the server in 192.168.204.10
will wait 45 seconds after the last packet sent to the server and then
will sent a probe every 5 seconds, 5 times...

if all of the above is right then if in the client i execute a PQexec() when
the connection has already drop it should detect the failure after 1
minute 10 seconds. is that right or am i misunderstanding this?

the reason i ask is that when i use that exact conninfo it detects the
failure condition after 15 minutes always... well, actually it waits the
same time even if i doesn't set anything...

i even used getsockopt() to ensure TCP_KEEPIDLE was being setted and
tried to set it myself with setsockopt() with the same results.

BTW, this paper (http://es.scribd.com/doc/2586622/tcpkeepalivehowto) on
section "4.2. The setsockopt function call" page 9 says that to set
TCP_KEEPIDLE, TCP_KEEPINTVL and TCP_KEEPCNT we should use level SOL_TCP
but on src/interfaces/libpq/fe-connect.c we use IPPROTO_TCP instead.

any leads?

--
Jaime Casanova www.2ndQuadrant.com
Professional PostgreSQL
Soporte 24x7, desarrollo, capacitación y servicios

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2011-07-04 08:47:49 Re: keepalives_* parameters usefullness
Previous Message Michael Gould 2011-07-04 08:31:13 Re: Full GUID support