Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Aug 2006 16:21:44 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Bill Moran <wmoran@collaborativefusion.com>
Cc:        questions@freebsd.org
Subject:   Re: Reducing the timeout on a TCP connection
Message-ID:  <20060801212144.GH63872@dan.emsphone.com>
In-Reply-To: <20060801152107.eba203fa.wmoran@collaborativefusion.com>
References:  <20060801150226.0c911297.wmoran@collaborativefusion.com> <000401c6b59e$92d942d0$3c01a8c0@coolf89ea26645> <20060801152107.eba203fa.wmoran@collaborativefusion.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Aug 01), Bill Moran said:
> In response to "Ted Mittelstaedt" <tedm@toybox.placo.com>:
> > This is why the snmp protocol uses UDP, Bill.
> > 
> > You need to use something other than TCP for
> > monitoring.
> 
> Well ... if I'm monitoring a server that uses TCP (PostgreSQL) I
> can't rightly establish whether or not it's successfully accepting
> connections unless I used TCP as well.

What I do is ping the target server first, with a small (1s) timeout.
If the ping fails, I don't try the TCP socket.  If the ping succeeds, I
know the TCP connection will either complete or fail immediately.

Another option is to do non-blocking connects to as many servers as you
have fds available, and select()/poll()/kqueue() for the results.  that
way at least you're checking other machines while waiting for the few
dead ones.

-- 
	Dan Nelson
	dnelson@allantgroup.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060801212144.GH63872>