Re: Reducing the timeout on a TCP connection
- From: Bill Moran <wmoran@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 1 Aug 2006 17:25:13 -0400
In response to Philip Hallstrom <freebsd@xxxxxxxxxxxxxxx>:
I'm writing some monitoring scripts, and I'm having some trouble because
the TCP seems to wait 90 seconds before giving up on initiating a
(The script is in PHP, testing a PostgreSQL database. Neither PHP nor
libpq (which PHP's PostgreSQL support is based on) seem to have any
settings that can be used to adjust this timeout).
Last parameter is a timeout value... I'd imagine the other socket calls
have something similar... whether or not it's honored I dunno, but it is
Although maybe i'm misunderstanding the question.
Thanks, Philip. Between your and Ted's advice, I've decided to do a three-
1) I test to see if I can establish a socket with fsockopen, with a fairly
short timeout. This gives me a quick response in the event of a total
failure that takes the server offline.
2) I then test using pg_connect() which has (apparently) a 90s timeout,
but gives me more thorough testing in case PG is running, but
3) Finally I execute a simple but telling SQL query that will give me a
cursory feel for whether the data in the datbase is healthy.
This gives me a lot of config values for various timeouts and the ability
to check for several scenarios (from total HW failure, to PostgreSQL going
bonkers) with configurable reaction times. Further testing should help me
to understand what numbers make good timeouts for the various stages.
Collaborative Fusion Inc.
freebsd-questions@xxxxxxxxxxx mailing list
To unsubscribe, send any mail to "freebsd-questions-unsubscribe@xxxxxxxxxxx"