Re: Reducing the timeout on a TCP connection



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
connection.

(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).

http://www.php.net/fsockopen

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
there.

Although maybe i'm misunderstanding the question.

Thanks, Philip. Between your and Ted's advice, I've decided to do a three-
tiered test.

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
misbehaving.
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.

--
Bill Moran
Collaborative Fusion Inc.
_______________________________________________
freebsd-questions@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: How to clean up routing cache?
    ... I actually need criteria that shows that DNS response is slow. ... The local cashing of response disturbs the picture since the timeout ... value for the cache seems longer than i am going to do probing... ... > And even if your host did not cache the negative answer, ...
    (comp.unix.solaris)
  • RE: Preparing for upcoming DNSSEC changes on 5/5
    ... "Mine are all saying "x.x.x.x sent EDNS buffer size 4096" when I run the ... If the response is bigger ... that 1460 it won't get through, named will timeout, try a different ... Now we do the same with a edns-udp-size set to 1460. ...
    (comp.protocols.dns.bind)
  • Re: SMTPClient Message.Send Error - please help!!!
    ... Thanks for the response. ... you can develop retry logic. ... if failure wait for incremeneted timeout ... S> Service not available, closing transmission channel. ...
    (microsoft.public.dotnet.framework)
  • Re: Script halts after 60 minutes
    ... Checked if php was running in safe mode, ... Does your server have a timeout value specified? ... Jerry Stuckle ... JDS Computer Training Corp. ...
    (comp.lang.php)
  • Re: Script halts after 60 minutes
    ... Checked if php was running in safe mode, ... Does your server have a timeout value specified? ... JDS Computer Training Corp. ... It looks like you're running PHP as a CGI, ...
    (comp.lang.php)