You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by sebb <se...@gmail.com> on 2016/01/05 15:05:42 UTC

Re: httpClient.getConnectionManager() performance with HTTP only

On 22 December 2015 at 08:36, Oleg Kalnichevski <ol...@apache.org> wrote:
> On Sun, 2015-12-20 at 22:44 +0100, Philippe Mouawad wrote:
>> Hi Oleg,
>> Back to this old subject and knowing that we must stick to 1 HttpClient per
>> thread (as per all the discussion that followed this).
>> Is there a plan to implement this lazy init of SSLContext in HttpClient as
>> it used to be the case in HC3 ?
>>
>> For our project, it's a killer in terms of performance, and for other use
>> cases, it appears kind of weird that an SSLContext is initialized even for
>> a pure HTTP traffic.
>>
>
> Given that HttpClient instance should be initialized only once, eager
> initialization of the SSLContext looks reasonable to me.

AFAICT there are lots of ways to configure the HttpClient instance by
using HttpClientBuilder or HttpClients.
So I don't understand why you say that the HttpClient instance should
only be initialised once.

> One, of course, can make SSL initialization lazy by using a custom
> connection socket factory with SSLContext initialized on demand.
>
> Hope this helps
>
> Oleg
>
>> Thanks
>> Regards
>>
>>
>>
>> On Thu, May 15, 2014 at 10:39 AM, Oleg Kalnichevski <ol...@apache.org>
>> wrote:
>>
>> > On Wed, 2014-05-14 at 19:46 +0100, sebb wrote:
>> > > On 14 May 2014 12:28, Oleg Kalnichevski <ol...@apache.org> wrote:
>> >
>> > ...
>> >
>> > > >> Issue is not present in HTTPCLient 3.1
>> > > >
>> > > > Philippe
>> > > >
>> > > > If HttpClient is used correctly, this code should only be executed only
>> > > > once. Why does JMeter create more than one instance of HttpClient?
>> > >
>> > > We currently create an instance for each instance of different proxy
>> > > settings and each protocol and each authority, because the client is
>> > > created with these settings.
>> > >
>> > > This is also done for each thread.
>> > >
>> > > IIRC, this was necessary originally. We have not rewritten the code
>> > > yet to use all the latest features.
>> > >
>> >
>> > I see. For the time what you can do is to use a custom SSL socket
>> > factory that lazily initializes SSL context when requested for the first
>> > time. This is exactly what HC 3.1 does. It will be somewhat slower given
>> > that one would need to mutex to synchronize access to the initialization
>> > code.
>> >
>> > Oleg
>> >
>> > > > Oleg
>> > > >
>> > >
>> > > ---------------------------------------------------------------------
>> > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>> > > For additional commands, e-mail: httpclient-users-help@hc.apache.org
>> > >
>> >
>> >
>> >
>>
>>
>
>

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


Re: httpClient.getConnectionManager() performance with HTTP only

Posted by Philippe Mouawad <ph...@gmail.com>.
Hello,
For information on a test plan with following configuration (15 threads, 5
minutes run) we make 138% more samples with 3.0 than with 2.13 thanks to
fixing of https://bz.apache.org/bugzilla/show_bug.cgi?id=58099.
The gain is due to the non init of SSL Context when only HTTP is used.
Maybe including this in HttpClient should be reconsidered.

Regards
Philippe

On Wed, Feb 17, 2016 at 7:47 PM, Philippe Mouawad <
philippe.mouawad@gmail.com> wrote:

> Hello,
> I think I have fixed the issue in JMeter, I attached patch to:
> - https://bz.apache.org/bugzilla/show_bug.cgi?id=58099
>
> Reviews and feedback very welcome.
> Regards
>
> On Tue, Jan 5, 2016 at 3:05 PM, sebb <se...@gmail.com> wrote:
>
>> On 22 December 2015 at 08:36, Oleg Kalnichevski <ol...@apache.org> wrote:
>> > On Sun, 2015-12-20 at 22:44 +0100, Philippe Mouawad wrote:
>> >> Hi Oleg,
>> >> Back to this old subject and knowing that we must stick to 1
>> HttpClient per
>> >> thread (as per all the discussion that followed this).
>> >> Is there a plan to implement this lazy init of SSLContext in
>> HttpClient as
>> >> it used to be the case in HC3 ?
>> >>
>> >> For our project, it's a killer in terms of performance, and for other
>> use
>> >> cases, it appears kind of weird that an SSLContext is initialized even
>> for
>> >> a pure HTTP traffic.
>> >>
>> >
>> > Given that HttpClient instance should be initialized only once, eager
>> > initialization of the SSLContext looks reasonable to me.
>>
>> AFAICT there are lots of ways to configure the HttpClient instance by
>> using HttpClientBuilder or HttpClients.
>> So I don't understand why you say that the HttpClient instance should
>> only be initialised once.
>>
>> > One, of course, can make SSL initialization lazy by using a custom
>> > connection socket factory with SSLContext initialized on demand.
>> >
>> > Hope this helps
>> >
>> > Oleg
>> >
>> >> Thanks
>> >> Regards
>> >>
>> >>
>> >>
>> >> On Thu, May 15, 2014 at 10:39 AM, Oleg Kalnichevski <ol...@apache.org>
>> >> wrote:
>> >>
>> >> > On Wed, 2014-05-14 at 19:46 +0100, sebb wrote:
>> >> > > On 14 May 2014 12:28, Oleg Kalnichevski <ol...@apache.org> wrote:
>> >> >
>> >> > ...
>> >> >
>> >> > > >> Issue is not present in HTTPCLient 3.1
>> >> > > >
>> >> > > > Philippe
>> >> > > >
>> >> > > > If HttpClient is used correctly, this code should only be
>> executed only
>> >> > > > once. Why does JMeter create more than one instance of
>> HttpClient?
>> >> > >
>> >> > > We currently create an instance for each instance of different
>> proxy
>> >> > > settings and each protocol and each authority, because the client
>> is
>> >> > > created with these settings.
>> >> > >
>> >> > > This is also done for each thread.
>> >> > >
>> >> > > IIRC, this was necessary originally. We have not rewritten the code
>> >> > > yet to use all the latest features.
>> >> > >
>> >> >
>> >> > I see. For the time what you can do is to use a custom SSL socket
>> >> > factory that lazily initializes SSL context when requested for the
>> first
>> >> > time. This is exactly what HC 3.1 does. It will be somewhat slower
>> given
>> >> > that one would need to mutex to synchronize access to the
>> initialization
>> >> > code.
>> >> >
>> >> > Oleg
>> >> >
>> >> > > > Oleg
>> >> > > >
>> >> > >
>> >> > >
>> ---------------------------------------------------------------------
>> >> > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>> >> > > For additional commands, e-mail:
>> httpclient-users-help@hc.apache.org
>> >> > >
>> >> >
>> >> >
>> >> >
>> >>
>> >>
>> >
>> >
>>
>
>
>
> --
> Cordialement.
> Philippe Mouawad.
>
>
>


-- 
Cordialement.
Philippe Mouawad.

Re: httpClient.getConnectionManager() performance with HTTP only

Posted by Philippe Mouawad <ph...@gmail.com>.
Hello,
For information on a test plan with following configuration (15 threads, 5
minutes run) we make 138% more samples with 3.0 than with 2.13 thanks to
fixing of https://bz.apache.org/bugzilla/show_bug.cgi?id=58099.
The gain is due to the non init of SSL Context when only HTTP is used.
Maybe including this in HttpClient should be reconsidered.

Regards
Philippe

On Wed, Feb 17, 2016 at 7:47 PM, Philippe Mouawad <
philippe.mouawad@gmail.com> wrote:

> Hello,
> I think I have fixed the issue in JMeter, I attached patch to:
> - https://bz.apache.org/bugzilla/show_bug.cgi?id=58099
>
> Reviews and feedback very welcome.
> Regards
>
> On Tue, Jan 5, 2016 at 3:05 PM, sebb <se...@gmail.com> wrote:
>
>> On 22 December 2015 at 08:36, Oleg Kalnichevski <ol...@apache.org> wrote:
>> > On Sun, 2015-12-20 at 22:44 +0100, Philippe Mouawad wrote:
>> >> Hi Oleg,
>> >> Back to this old subject and knowing that we must stick to 1
>> HttpClient per
>> >> thread (as per all the discussion that followed this).
>> >> Is there a plan to implement this lazy init of SSLContext in
>> HttpClient as
>> >> it used to be the case in HC3 ?
>> >>
>> >> For our project, it's a killer in terms of performance, and for other
>> use
>> >> cases, it appears kind of weird that an SSLContext is initialized even
>> for
>> >> a pure HTTP traffic.
>> >>
>> >
>> > Given that HttpClient instance should be initialized only once, eager
>> > initialization of the SSLContext looks reasonable to me.
>>
>> AFAICT there are lots of ways to configure the HttpClient instance by
>> using HttpClientBuilder or HttpClients.
>> So I don't understand why you say that the HttpClient instance should
>> only be initialised once.
>>
>> > One, of course, can make SSL initialization lazy by using a custom
>> > connection socket factory with SSLContext initialized on demand.
>> >
>> > Hope this helps
>> >
>> > Oleg
>> >
>> >> Thanks
>> >> Regards
>> >>
>> >>
>> >>
>> >> On Thu, May 15, 2014 at 10:39 AM, Oleg Kalnichevski <ol...@apache.org>
>> >> wrote:
>> >>
>> >> > On Wed, 2014-05-14 at 19:46 +0100, sebb wrote:
>> >> > > On 14 May 2014 12:28, Oleg Kalnichevski <ol...@apache.org> wrote:
>> >> >
>> >> > ...
>> >> >
>> >> > > >> Issue is not present in HTTPCLient 3.1
>> >> > > >
>> >> > > > Philippe
>> >> > > >
>> >> > > > If HttpClient is used correctly, this code should only be
>> executed only
>> >> > > > once. Why does JMeter create more than one instance of
>> HttpClient?
>> >> > >
>> >> > > We currently create an instance for each instance of different
>> proxy
>> >> > > settings and each protocol and each authority, because the client
>> is
>> >> > > created with these settings.
>> >> > >
>> >> > > This is also done for each thread.
>> >> > >
>> >> > > IIRC, this was necessary originally. We have not rewritten the code
>> >> > > yet to use all the latest features.
>> >> > >
>> >> >
>> >> > I see. For the time what you can do is to use a custom SSL socket
>> >> > factory that lazily initializes SSL context when requested for the
>> first
>> >> > time. This is exactly what HC 3.1 does. It will be somewhat slower
>> given
>> >> > that one would need to mutex to synchronize access to the
>> initialization
>> >> > code.
>> >> >
>> >> > Oleg
>> >> >
>> >> > > > Oleg
>> >> > > >
>> >> > >
>> >> > >
>> ---------------------------------------------------------------------
>> >> > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>> >> > > For additional commands, e-mail:
>> httpclient-users-help@hc.apache.org
>> >> > >
>> >> >
>> >> >
>> >> >
>> >>
>> >>
>> >
>> >
>>
>
>
>
> --
> Cordialement.
> Philippe Mouawad.
>
>
>


-- 
Cordialement.
Philippe Mouawad.

Re: httpClient.getConnectionManager() performance with HTTP only

Posted by Philippe Mouawad <ph...@gmail.com>.
Hello,
I think I have fixed the issue in JMeter, I attached patch to:
- https://bz.apache.org/bugzilla/show_bug.cgi?id=58099

Reviews and feedback very welcome.
Regards

On Tue, Jan 5, 2016 at 3:05 PM, sebb <se...@gmail.com> wrote:

> On 22 December 2015 at 08:36, Oleg Kalnichevski <ol...@apache.org> wrote:
> > On Sun, 2015-12-20 at 22:44 +0100, Philippe Mouawad wrote:
> >> Hi Oleg,
> >> Back to this old subject and knowing that we must stick to 1 HttpClient
> per
> >> thread (as per all the discussion that followed this).
> >> Is there a plan to implement this lazy init of SSLContext in HttpClient
> as
> >> it used to be the case in HC3 ?
> >>
> >> For our project, it's a killer in terms of performance, and for other
> use
> >> cases, it appears kind of weird that an SSLContext is initialized even
> for
> >> a pure HTTP traffic.
> >>
> >
> > Given that HttpClient instance should be initialized only once, eager
> > initialization of the SSLContext looks reasonable to me.
>
> AFAICT there are lots of ways to configure the HttpClient instance by
> using HttpClientBuilder or HttpClients.
> So I don't understand why you say that the HttpClient instance should
> only be initialised once.
>
> > One, of course, can make SSL initialization lazy by using a custom
> > connection socket factory with SSLContext initialized on demand.
> >
> > Hope this helps
> >
> > Oleg
> >
> >> Thanks
> >> Regards
> >>
> >>
> >>
> >> On Thu, May 15, 2014 at 10:39 AM, Oleg Kalnichevski <ol...@apache.org>
> >> wrote:
> >>
> >> > On Wed, 2014-05-14 at 19:46 +0100, sebb wrote:
> >> > > On 14 May 2014 12:28, Oleg Kalnichevski <ol...@apache.org> wrote:
> >> >
> >> > ...
> >> >
> >> > > >> Issue is not present in HTTPCLient 3.1
> >> > > >
> >> > > > Philippe
> >> > > >
> >> > > > If HttpClient is used correctly, this code should only be
> executed only
> >> > > > once. Why does JMeter create more than one instance of HttpClient?
> >> > >
> >> > > We currently create an instance for each instance of different proxy
> >> > > settings and each protocol and each authority, because the client is
> >> > > created with these settings.
> >> > >
> >> > > This is also done for each thread.
> >> > >
> >> > > IIRC, this was necessary originally. We have not rewritten the code
> >> > > yet to use all the latest features.
> >> > >
> >> >
> >> > I see. For the time what you can do is to use a custom SSL socket
> >> > factory that lazily initializes SSL context when requested for the
> first
> >> > time. This is exactly what HC 3.1 does. It will be somewhat slower
> given
> >> > that one would need to mutex to synchronize access to the
> initialization
> >> > code.
> >> >
> >> > Oleg
> >> >
> >> > > > Oleg
> >> > > >
> >> > >
> >> > >
> ---------------------------------------------------------------------
> >> > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> >> > > For additional commands, e-mail:
> httpclient-users-help@hc.apache.org
> >> > >
> >> >
> >> >
> >> >
> >>
> >>
> >
> >
>



-- 
Cordialement.
Philippe Mouawad.

Re: httpClient.getConnectionManager() performance with HTTP only

Posted by Philippe Mouawad <ph...@gmail.com>.
Hello,
I think I have fixed the issue in JMeter, I attached patch to:
- https://bz.apache.org/bugzilla/show_bug.cgi?id=58099

Reviews and feedback very welcome.
Regards

On Tue, Jan 5, 2016 at 3:05 PM, sebb <se...@gmail.com> wrote:

> On 22 December 2015 at 08:36, Oleg Kalnichevski <ol...@apache.org> wrote:
> > On Sun, 2015-12-20 at 22:44 +0100, Philippe Mouawad wrote:
> >> Hi Oleg,
> >> Back to this old subject and knowing that we must stick to 1 HttpClient
> per
> >> thread (as per all the discussion that followed this).
> >> Is there a plan to implement this lazy init of SSLContext in HttpClient
> as
> >> it used to be the case in HC3 ?
> >>
> >> For our project, it's a killer in terms of performance, and for other
> use
> >> cases, it appears kind of weird that an SSLContext is initialized even
> for
> >> a pure HTTP traffic.
> >>
> >
> > Given that HttpClient instance should be initialized only once, eager
> > initialization of the SSLContext looks reasonable to me.
>
> AFAICT there are lots of ways to configure the HttpClient instance by
> using HttpClientBuilder or HttpClients.
> So I don't understand why you say that the HttpClient instance should
> only be initialised once.
>
> > One, of course, can make SSL initialization lazy by using a custom
> > connection socket factory with SSLContext initialized on demand.
> >
> > Hope this helps
> >
> > Oleg
> >
> >> Thanks
> >> Regards
> >>
> >>
> >>
> >> On Thu, May 15, 2014 at 10:39 AM, Oleg Kalnichevski <ol...@apache.org>
> >> wrote:
> >>
> >> > On Wed, 2014-05-14 at 19:46 +0100, sebb wrote:
> >> > > On 14 May 2014 12:28, Oleg Kalnichevski <ol...@apache.org> wrote:
> >> >
> >> > ...
> >> >
> >> > > >> Issue is not present in HTTPCLient 3.1
> >> > > >
> >> > > > Philippe
> >> > > >
> >> > > > If HttpClient is used correctly, this code should only be
> executed only
> >> > > > once. Why does JMeter create more than one instance of HttpClient?
> >> > >
> >> > > We currently create an instance for each instance of different proxy
> >> > > settings and each protocol and each authority, because the client is
> >> > > created with these settings.
> >> > >
> >> > > This is also done for each thread.
> >> > >
> >> > > IIRC, this was necessary originally. We have not rewritten the code
> >> > > yet to use all the latest features.
> >> > >
> >> >
> >> > I see. For the time what you can do is to use a custom SSL socket
> >> > factory that lazily initializes SSL context when requested for the
> first
> >> > time. This is exactly what HC 3.1 does. It will be somewhat slower
> given
> >> > that one would need to mutex to synchronize access to the
> initialization
> >> > code.
> >> >
> >> > Oleg
> >> >
> >> > > > Oleg
> >> > > >
> >> > >
> >> > >
> ---------------------------------------------------------------------
> >> > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> >> > > For additional commands, e-mail:
> httpclient-users-help@hc.apache.org
> >> > >
> >> >
> >> >
> >> >
> >>
> >>
> >
> >
>



-- 
Cordialement.
Philippe Mouawad.