Re: keepalives on MacOS X - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: keepalives on MacOS X
Date
Msg-id AANLkTinIMZ_7y6gX_N0uW74qha-dE2luFW-O5qIQSjYK@mail.gmail.com
Whole thread Raw
In response to Re: keepalives on MacOS X  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: keepalives on MacOS X  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Tue, Jun 29, 2010 at 11:28 PM, Robert Haas <robertmhaas@gmail.com> wrote:
> On Tue, Jun 29, 2010 at 12:42 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Yeah, a bit of rooting around in the Darwin sources shows that this
>> value is used as a per-connection override for tcp_keepidle.  So it
>> is a synonym.  Not sure if it's worth supporting when the other value
>> can't be set too.  Maybe it'd be more useful to document that people can
>> set the system-wide values if they're desperate.
>
> Well, the default value for tcp_keepidle is 2 hours, and the default
> value for tcp_keepintvl is 75 seconds.  Assuming that tcp_keepcount
> defaults to something reasonable (I think the default on Linux is 9),
> the lion's share of the time will be waiting for tcp_keepidle - so
> just the ability to reduce that value to something reasonable should
> help a lot.  It's also not much code - proposed patch attached.

src/interfaces/libpq/fe-connect.c
+        appendPQExpBuffer(&conn->errorMessage,
+                          libpq_gettext("setsockopt(TCP_KEEPIDLE) failed: %s\n"),
+                          SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf)));

s/TCP_KEEPIDLE/TCP_KEEPALIVE

Don't we need to change pq_getkeepalivesidle?

In pq_setkeepalivesidle, if neither TCP_KEEPIDLE nor TCP_KEEPALIVE are
supported, the following message is output.
   setsockopt(TCP_KEEPIDLE) not supported

We should change it to something like?
   neither setsockopt(TCP_KEEPIDLE) nor setsockopt(TCP_KEEPALIVE) are supported

Regards,

--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: pg_archive_bypass
Next
From: Tom Lane
Date:
Subject: Re: Cannot cancel the change of a tablespace