Thank you Sam and Oleg.. your answers are quite sufficient!

regards!

/Ole

Sam Gw skrev:
Dear Ole,

   I had exactly the same problem with you. And I found the solution.
If you are using Windows, the problem may be caused by system constraint.
Windows restricts application to limit tcp port range. And TIME-WAIT time default value is 240 sec. If you rapidly generate request and close it. It will cracking throw BindingException.

   You have to tune tcp value in Windows registry. Like below :

  TcpTimedWaitDelay = 30 (Default = 240)

   MaxUserPort = 65534 (Default = 5000)

   SynAttackProtect = 0 (Default = 0)

   MaxFreeTcbs = 20000 (Default = 1000)

   MaxHashTableSize = 20000 (Default = 512)

   Reboot. And re-run your app.

If you don't know how to change those value. You could try to search "TcpReg.exe" tool.
It will help you.

regrads,

Sam Gw

Oleg Kalnichevski wrote:
On Wed, 2006-03-22 at 12:38 +0100, Ole Matzura wrote:
Hi all!

I have a "strange" problem.. I'm running loadtests on a local IIS using a MultiThreadedConnectionManager created as follows:

MultiThreadedHttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
connectionManager.getParams().setDefaultMaxConnectionsPerHost( 500 );
connectionManager.getParams().setMaxTotalConnections( 2000 );
httpClient = new HttpClient(connectionManager);

(i've tried lower values with the same results)

My loadtest runs 10 parallell threads which create new PostMethods containing a "Connection: close" header for each request.

Well. Since you force connection close per each request, at some point
your process may create more sockets than the OS can allocate enough
local ports for. The fact that HttpClient called #close() on the
java.net.Socket instance may not necessarily mean that the local port
used by the socket can immediately be made available for a new socket

Oleg

After each request I call postMethod.releaseConnection().. (in a finally block)

After about 3600 requests i get an exception when calling httpClient.executeMethod( postMethod );

java.net.BindException: Address already in use: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
    at java.net.Socket.connect(Socket.java:507)
    at java.net.Socket.connect(Socket.java:457)
    at java.net.Socket.<init>(Socket.java:365)
    at java.net.Socket.<init>(Socket.java:238)
at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:79) at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:121) at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:706) at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1321) at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:386) at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)

running netstat from the command line shows a list of thousands of active connections.. shouldn't these have been closed? IIS returns the Connection: close header in the response. Why am I running out of connections/sockets/ports/whatever? What am I doing wrong? Can I "force" the closing of the requests some other way?

thanks for any help!

regards,

Ole


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to