hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Quintin Beukes" <quin...@last.za.net>
Subject Re: isStale()
Date Sat, 21 Jun 2008 18:38:51 GMT
> What are the functional requirements you are trying to fulfill? What is
> it exactly you are trying to achieve?

I need to detect when a connection is open or not.

But let me draw a picture of my problem. I have a max of 20 connections.
After a period of high concurrency all these connections were opened and
added to the pool. Then a period of quiet follows and all these sockets time
out. Now the pool has 20 references to closed connections.

So I try one. The pool thinks it's still open and returns it. A NoResponse
exception is thrown. I remove it and try another one, same story.

I remove it, but this time I try with an isStale() check. The isStale()
check doesn't really help in this case, but I would like to be able to have
some check that can see if the connection is open. I figured I could write
my own isStale() check that sends a request to the server, but if NIO is
possible, it would be much nicer to have a reliable isOpen() check done
first, to avoid the overhead of making an actual request to the server.

The side effect of the above problem is that the next 20 connections fail,
since it first tries to use all those in the pool.

An alternative is to force open a new connection on the 3rd try, but I would
also like to be able to check if a connection is really open.

> Why would you need anything else? A connection is either re-usable or
> not?

We used to use a commercial load balancer, and am implementing some of it's
features into our custom one.

These are ones like reusing connections to benefit from the server's cache.
Like if a certain server just served http://somehost/logo.png, then have
that same server serve it again.

This one can be implemented in the TargetHost selection, but not ones like
configurable per host maximums. Like Host X can only have 10 open
connections, where the stronger host Y can have 20 open connections. Or if
host Z doesn't have available connections, host Y can stand in and take
over the request if certain conditions are met, and this has to update the
Heap structure for the load balancer. An example of such a condition is for
example, is this a request for a list of known static files of less than
100kbss. If these conditions aren't met, then the connection fetching should
block until one becomes available.

Quintin Beukes

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message