hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jaya Christina B" <bj...@mahindrabt.com>
Subject RE: Does HttpClient create connections on fly
Date Fri, 16 Dec 2005 06:39:31 GMT

Bharathi,
I think you should use MultiThreadedHttpConnectionManager  & should
create ONE httpClient object for your entire application.
Pooling will be managed by MultiThreadedHttpConnectionManager  .

Creating on httpClient  for every request can be disastrous... I learnt
the heard way...
It cud soon result in out of memory error. So, do reuse the HttpClient.

HTH

Regards,
Jaya.



________________________________

From: bharathi swarajya [mailto:ssbharathi71@rediffmail.com]
Sent: Friday, December 16, 2005 9:41 AM
To: httpclient-user@jakarta.apache.org
Subject: Does HttpClient create connections on fly




I require an important information regarding Commons Http Client. I am
working in a project where we launch 4 to 5 threads from a page and then
each thread will be connecting to a server machine where all the threads
connect to the same port. The peak load of users accessing might be 60
to 80. So at a time 240-320 threads might be launched. We don't want to
recreate connections, but want a pooling mechanisms where connection
wont be closed and can be used by the subsequent threads. I was running
a test class using MultiThreadedHttpConnectionManager class and
HtppClient. but when I was verifying the no of connections on the server
all were established and I found that the connections were not getting
reused. We need a response for each thread with in 2 -3 secs. So I tried
a sample code where each thread sleeps for the same amount of time i.e 3
seconds  and found that 500 threads took 3 minutes and 150 threads took
34 seconds. Could you please suggest us how to proceed further and does
HttpClient supports pooling. Also does it create connections on fly. How
are the connections created.I am also attaching the sample code which I
tried. Could any one please guide further on this.


Thanks
S.S. Bharathi

*********************************************************
Disclaimer:

The contents of this E-mail (including the contents of the enclosure(s) or attachment(s) if
any) are privileged and confidential material of MBT and should not be disclosed to, used
by or copied in any manner by anyone other than the intended addressee(s).   In case you are
not the desired addressee, you should delete this message and/or re-direct it to the sender.
 The views expressed in this E-mail message (including the enclosure(s) or attachment(s) if
any) are those of the individual sender, except where the sender expressly, and with authority,
states them to be the views of MBT.

This e-mail message including attachment/(s), if any, is believed to be free of any virus.
 However, it is the responsibility of the recipient to ensure that it is virus free and MBT
is not responsible for any loss or damage arising in any way from its use

*********************************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Mime
View raw message