Re: how to handle socket timeout?
- From: Arkadiy <vertleyb@xxxxxxxxx>
- Date: Tue, 15 Jan 2008 08:59:58 -0800 (PST)
On Jan 15, 11:03 am, David Schwartz <dav...@xxxxxxxxxxxxx> wrote:
Why does it matter what you do in this case? The server is
unreachable. Nothing will work. It doesn't matter what you do or try
to do to the connection. There will be no response, so you will have
no response to give. You can give up waiting whenever you want, but
with respect to the connection, what you send, and what you detect, it
doesn't matter.
It does for me. I want to start attempts to reconnect, in a different
thread, through the configurable interval of time. Once the server
stops being unreachable, the connect will succeed, and I will have
connections in my pool, ready to use. Until then, all my requests
immediately return failure since there is no available connections.
But, once the server stops being unreachable, the requests start
succeeding.
I think this model allows me to achieve the goal of "fast result or no
result". The notion of "fast" is configurable by the timeout value.
Let's say I setup all the facility on the LAN, and the server's
average response time is 0.1 msec. If I set the timeout to, for
example, 1 msec, everything will go smoothly most of the time. When I
get a timeout, this may mean one of a few things:
1) The server became unreachable. I want to close the socket and
start attempts to reconnect;
2) Accidentially long response. Still nothing wrong with
reconnecting, since this happens rearly (how rarely -- can be
controlled by the value of the timeout);
3) Server is congested. This is the worst case. But, IMO, this is
the case where nothing can be done. Except adding another server
instance to split the load.
4) Network is congested. Again, I don't see what can be done in this
case.
So it seems to me that reconnect works OK for both cases where
anything can be done -- I just need to setup reasonably large timeout
-- sufficiently larger than the average response time under normal
conditions. For two other cases, it seems yes, I am adding a bit to
already existing mess. But does this really matter?
Am I missing something?
Regards,
Arkadiy
.
- Follow-Ups:
- Re: how to handle socket timeout?
- From: Rainer Weikusat
- Re: how to handle socket timeout?
- From: David Schwartz
- Re: how to handle socket timeout?
- References:
- how to handle socket timeout?
- From: Arkadiy
- Re: how to handle socket timeout?
- From: Arkadiy
- Re: how to handle socket timeout?
- From: Rainer Weikusat
- Re: how to handle socket timeout?
- From: Arkadiy
- Re: how to handle socket timeout?
- From: Rainer Weikusat
- Re: how to handle socket timeout?
- From: Arkadiy
- Re: how to handle socket timeout?
- From: Rick Jones
- Re: how to handle socket timeout?
- From: Rick Jones
- Re: how to handle socket timeout?
- From: Arkadiy
- Re: how to handle socket timeout?
- From: David Schwartz
- Re: how to handle socket timeout?
- From: Arkadiy
- Re: how to handle socket timeout?
- From: David Schwartz
- Re: how to handle socket timeout?
- From: Arkadiy
- Re: how to handle socket timeout?
- From: David Schwartz
- how to handle socket timeout?
- Prev by Date: Re: Makefile question
- Next by Date: gcc: questions about segments
- Previous by thread: Re: how to handle socket timeout?
- Next by thread: Re: how to handle socket timeout?
- Index(es):
Relevant Pages
|