Re: Setting TCP keepalive for Cyrus daemons

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Feb 13, 2010 at 09:09:05PM +1100, Bron Gondwana wrote:
> On Fri, Feb 12, 2010 at 09:45:02AM -0600, Gary Mills wrote:
> > I'm willing to add a `keepalive' option to Cyrus master along with the
> > setsockopt() system call to enable that setting.  This option could be
> > added to the cyrus.conf file for any services that could benefit from
> > it. Would this be a reasonable addition to Cyrus?
> 
> How does this look?

Wow, you beat me to it!  You even covered all of the settings.

> +{ "tcp_keepalive", 0, SWITCH }
> +/* Enable keepalive on TCP connections */
> +
> +{ "tcp_keepalive_cnt", 0, INT }
> +/* Number of TCP keepalive probes to send before declaring the 
> +   connection dead (0 == system default) */
> +
> +{ "tcp_keepalive_idle", 0, INT }
> +/* Number of seconds a connection must be idle before keepalive
> +   probes are sent (0 == system default) */
> +
> +{ "tcp_keepalive_intvl", 0, INT }
> +/* Number of seconds between keepalive probes (0 == system default) */
> 
> A switch to enable keepalive, plus options to edit each of the
> tunables.  The full patch is attached - not tested except for
> a compile yet.

I can't comment on imap/sync_client.c because I don't use that
technique.  In master.c, I would have put my changes into
spawn_service(), just before master exec'ed the daemon.  However,
putting them where the connection was first accepted should be fine
too.

One thing to watch is that only SO_KEEPALIVE is standard.  The other
three symbols: TCP_KEEPCNT, TCP_KEEPIDLE, and TCP_KEEPINTVL only exist
in some operating systems.  They have global settings but don't have
per-socket options.  For these, the setsockopt() function calls need
to be conditional on the symbols.

For which Cyrus version is your patch intended.  I'm still running
cyrus-imapd-2.3.8 .

-- 
-Gary Mills-        -Unix Group-        -Computer and Network Services-
----
Cyrus Home Page: http://cyrusimap.web.cmu.edu/
Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html

[Index of Archives]     [Cyrus SASL]     [Squirrel Mail]     [Asterisk PBX]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [KDE]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux