Ok, I considered reusing HttpClient, but when I saw methods such as
HttpClient.getHost() and getPort(), they implied that at the very least
it's not a thread safe class to use. If i have multiple threads
executing within one HttpClient object at the same time, and I call
HttpClient.getHost(), what's going to happen?

-----Original Message-----
From: Oleg Kalnichevski [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 08, 2004 12:23 PM
To: Commons HttpClient Project
Subject: Re: question about performance

Gil,
(1) First and foremost DO reuse HttpClient instances when using
multi-threaded connection manager. HttpClient class is thread-safe. In
fact there are no known problems with having just one instance of
HttpClient per application. Using a new instance of HttpClient for
processing each request totally defeats all the performance
optimizations we have built into HttpClient

(2) Use multi-threaded connection manager in case you do not

(3) Disable stale connection check

(4) Do not use connect timeout which causes a controller thread to be
spawned per connection attempt

Oleg

On Thu, 2004-04-08 at 21:02, Alvarez, Gil wrote:
> We recently ported our url-hitting code from using java.net.* code to
> httpclient code. We use it in a high-volume environment (20 machines
are
> hitting an external 3rd party to retrieve images).
> 
>  
> 
> 
> 
> After the port, we saw a significant increase in cycles used by the
> machines, about 2-3 times (ie, the load on the boxes increased from
> using up 20% of the cpu, to about 50%-60% of the cpu.
> 
>  
> 
> For each request, we instantiate an HttpClient object, and a GetMethod
> object, and shut things down afterwards.
> 
>  
> 
> In order to reduce the use of cycles, what is the recommended
approach?
> 
>  
> 
> Thank you.
> 


---------------------------------------------------------------------
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