mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luc Willems <willems....@pandora.be>
Subject Strange Connection behaviour with HTTP connections
Date Wed, 16 Jan 2008 17:58:40 GMT

	Hello all,

i'm working on a load generator tool for simulating client access to a server with a XML/HTTP
based protocol.

this basicly means that we have "MANY" clients connections (5000 and more ) to  a J2EE server
connected and exchanging a lot of XML documents at a ratio of 
500 HTTP request per sec. So each client send a request at  10 seconds of more (with more
clients)  the client code is based on MINA 2.0  prerelease of 28/12 .

The J2EE server has a overload protection system that basicly closes the connection when a
overload situation occures. 
connections are closed with  HTTP 503 error (service unavailable)

as part of "auto test recovery" , the client will wait a short time (few seconds)  and than
try again.

No here starts the problem. When a HTTP error occurse , the connection is closed by the client.
next time ,>10 seconds later , a new connection is requested from a connection factory
class. this factory looks basicly like this :

	public IoSession getConnection(SessionInitializer handler) throws ConnectException {
		cf=connector.connect(host,port,handler) ;
		cf.awaitUninterruptibly(40sec)
		if (! cf.isconnected() ) {
        	    cf.cancel()
	    	    throw new ConnectException("timeout connection");
                 }
		return cf.getSession()
       }

connector as setConnectTimeout() set to 30 seconds, my clientcode (the handler) implements
the IoHandler interface and log all IoEvents.

when i reconnect to the server, i get the sessionCreated(IoSession session)  & sessionOpened(IoSession
session) 
but the ConnectFuture cf doesn't return a valid isConnected() or IoSession. 
it only times-out at 40 seconds and the ConnectException is thrown.

Validating the connections with ethereal shows that the connection is created but never 
used (because ConnectException cause the client to go to sleep for awhile and than retry).

the connecting thread will block "forever" when i replace the cf.awaitUninterruptibly() with
cf.await() :-( 

somehow, the connection is not notified to the connectFuture.
in my logfile i can see that connection was established in very short time (< 1sec)


	luc





Mime
View raw message