On Monday 05 April 2010 06:12:02 am Oleg Kalnichevski wrote: > On Mon, 2010-04-05 at 00:20 -0400, [email protected] wrote: > > Used multiple threads to connect to the same server > > (httpcomponents-client 4.0.1). Each thread represents an account on the > > server and has different username/password combination, so different > > cookies. Normally 1000 threads are used. The problem is, even though I > > configured the ThreadSafeClientConnManager to use 2000 connections, it > > seems that it only used 2 to 3 connections at the same time (I used > > fiddler to check it). 1000 requests (one request per thread) takes about > > 500 seconds to complete. Unacceptable performance. Most probable reason > > is incorrect configuration. I'm new to network programming and > > httpcomponents, and I can not figure out and solve the problem. Your > > help is much appreciated. > > Maximum of two concurrent connections to the same host is a requirement > of the RFC 2616. You can increase the limit of maximum connections per > host, if desired, as described here: > > http://hc.apache.org/httpcomponents-client-4.0.1/tutorial/html/connmgmt.htm > l#d4e596 > > Oleg > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > Thanks, that solved my problem.
Initially I set max connection per route to 200, and got a mysterious ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2. I then decreased the number to 100, the error went away. Finally I settled down with 20, that is the optimal number for me. It is also the number used by the example in Oleg's HttpClient Tutorial (coincidentally???) --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
