On Tue, Jul 19, 2005 at 01:41:08PM -0300, Bruno Borges wrote: > So you're saying that it'll be much better having one instance of > HttpState and HostConfiguration per service and call the > executeMethod(HostConfiguration hostconfig, HttpMethod method, > HttpState state) in the same HttpClient(MTHCM) instance? >
Yes, Sir. For more details you may want to take a look at the HttpClient optimization guide: http://jakarta.apache.org/commons/httpclient/performance.html#Concurrent%20execution%20of%20HTTP%20methods > Sounds good to me. > > But I still remain in the problem about the 2 connections per host > limit. Because it can happen that two users request info from the same > service, and I don't want to have users waiting so long. > There's absolutely no harm in allowing more than two concurrent connections per host. This recommendation was made in the early days of HTTP/1.0 when each request implied a new connection to the target host. Think of a browser downloading an HTML page with a few dozens of images. This can easily bring the target server to its knees if several browsers attempted to download all the images simultaneously. Hope this helps Oleg > On 7/19/05, Oleg Kalnichevski <[EMAIL PROTECTED]> wrote: > > On Tue, Jul 19, 2005 at 12:58:32PM -0300, Bruno Borges wrote: > > > I'm wondering if some of you could clear some doubts I have about > > > HttpClient, specially the MultiThreadedHttpConnectionManager class. If > > > you can't, please stop reading this e-mail and press the Delete > > > button. :) > > > > > > ... > > > > > > Well, thanks for your attention and your time. > > > I'm developing a tool that access several pages and extract > > > informations the client needs, and to do that, I'm using HttpClient > > > 3.0rc3. So I created a pool of Services (classes that push some kind > > > of information from somewhere) and for each service there is one > > > HttpClient instance. > > > Looking at the source code, I discover a special note about RFC > > > 2616, that explains about how many connections can be open to the same > > > host, and that limit's up to 2 connections. > > > So, here I go. Each HttpClient with its own MTHCM will function like > > > one browser instance and running all Services I need will produce a > > > clean result without any problem, or, can I optimize and use only one > > > MTHCM's instance for all Service's HttpClient setting more than 2 > > > connections per host ? > > > > Bruno, > > > > In fact you'll be much better off using only one instance of HttpClient > > and allocating separate HttpState and HostConfiguration instances per > > service / execution thread. When used with a thread-safe connection > > manager such as MTHCM HttpClient is fully thread-safe > > > > Oleg > > > > > > > > > > > -- > > > Bruno Borges - SCJP 1.4 > > > [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] > > > > > > > -- > Bruno Borges - SCJP 1.4 > [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]
