From: | Oliver Jowett <oliver(at)opencloud(dot)com> |
---|---|
To: | pgsql-patches(at)postgresql(dot)org |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Subject: | Implement support for TCP_KEEPCNT, TCP_KEEPIDLE, TCP_KEEPINTVL (was Re: [HACKERS] Feature freeze date for 8.1) |
Date: | 2005-05-03 01:49:56 |
Message-ID: | 4276D8C4.7090802@opencloud.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
Tom Lane wrote:
> Oliver Jowett <oliver(at)opencloud(dot)com> writes:
>
>>Tom Lane wrote:
>>
>>>I'm not convinced that Postgres ought to provide
>>>a way to second-guess the TCP stack ...
>
>
>>Would you be ok with a patch that allowed configuration of the
>>TCP_KEEPCNT / TCP_KEEPIDLE / TCP_KEEPINTVL socket options on backend
>>sockets?
>
>
> [ shrug... ] As long as it doesn't fail to build on platforms that
> don't offer those options, I couldn't complain too hard. But do we
> really need all that?
Here's a patch that adds four new GUCs:
tcp_keepalives (defaults to on, controls SO_KEEPALIVE)
tcp_keepalives_idle (controls TCP_KEEPIDLE)
tcp_keepalives_interval (controls TCP_KEEPINTVL)
tcp_keepalives_count (controls TCP_KEEPCNT)
They're ignored for AF_UNIX connections and when running standalone.
tcp_keepalives_* treat 0 as "use system default". If the underlying OS
doesn't provide the TCP_KEEP* socket options, the GUCs are present but
reject any value other than 0.
SHOW reflects the currently-in-use value or 0 if not applicable or not
known. i.e. if you set it to 0 and you have the socket options
available, SHOW will show the result of getsockopt() which is non-zero.
A default install on my Linux system produces:
template1=# show all;
name | setting
--------------------------------+----------------------------------------------
[...]
tcp_keepalives | on
tcp_keepalives_count | 9
tcp_keepalives_idle | 7200
tcp_keepalives_interval | 75
[...]
I haven't had a chance to check it builds on other systems or to test
that this handles actual network failures nicely yet.
-O
Attachment | Content-Type | Size |
---|---|---|
pgsql-support-tcp-keepalives.txt | text/plain | 16.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-05-03 02:43:01 | Re: pg_locks needs a facelift |
Previous Message | Neil Conway | 2005-05-03 01:02:38 | Re: SPI bug. |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-05-03 02:02:29 | Re: Added columns to pg_stat_activity |
Previous Message | Neil Conway | 2005-05-03 00:27:22 | Re: Added columns to pg_stat_activity |