a) You can try reusing your connections for the subsequent post methods, if this fits in your test scenario. b) Put socket timeout. ttpClient.setTimeout() andHttpClient.setConnectionTimeout() should suffice. c) Bind exceptions can also come since on Unix there is a limit of number of total TCP sockets you can open. This limit is 1024. You can increase this limit by ulimit command.
I hope it helps. Raj -----Original Message----- From: Aaron [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 16, 2005 3:25 PM To: [email protected] Subject: rapid http connection use Hi, I am writing a performance testing tool that uses HttpClient; the tool kicks off N threads, and each thread creates a PostMethod and executes it via an HttpClient instance (configured with MultiThreadedHttpConnectionManager). When each request thread finishes, another thread takes its place immediately and creates/executes another post method using the same HttpClient. The result is that I am rapidly creating PostMethods and executing them. (I am ensuring that releaseConnection() is called in each thread.) I am getting repeated java.net.BindExceptions, and I understand from the research that I've done that this can happen if you are creating socket connections so rapidly. This has to do with TCP connections sitting in a CLOSED state for some time after being closed. My tool can be configured to have each request thread sleep some number of milliseconds after releasing its connection. When I configure this sleep time to be high (~1 sec), the BindExceptions go away. I assume this is time needed for the released TCP connection to leave its CLOSED state. However, that this sleep time must be so high is what concerns me. HttpClient experts, can you help me around this issue? How do I dispatch these threads more quickly, without getting BindExceptions? Thanks for any insights-- Aaron --------------------------------------------------------------------- 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]
