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 Philippe Mouawad <p....@ubik-ingenierie.com> on 2020/07/01 17:03:10 UTC
Re: Migration from HC4 to HC5 : few questions
Hello Oleg,
Sorry for late reply, this mail was in my drafts, while I thought I had
sent it.
*Thank you for your detailed answers and rapid feedback.*
All this helps a lot !
Regarding HttpConnectionMetrics, since we need metrics per request and not
per connection, my understanding is that we would need a reset method, do I
understand well ?
Regards
Philippe
On Thu, Jun 11, 2020 at 12:35 PM Oleg Kalnichevski <ol...@apache.org> wrote:
> On Wed, 2020-06-10 at 19:11 +0200, Philippe Mouawad wrote:
> > Hello,
> > I am looking into migrating Apache JMeter project from HC4 to HC5 to
> > benefit from the new features for Classic HttpClient like the new
> > lax
> > connection pool and performance improvements.
> > In the future we would hopefully switch to Async.
> >
> > First thanks for this documentation, very useful ! :
> >
> https://ok2c.github.io/httpclient-migration-guide/migration-to-classic.html
> >
> > Few questions:
> >
> > 1. I don't see an equivalent of
> > RequestConfig.Builder#setLocalAddress ?
> > How do we get this feature ?
>
> RequestConfig.Builder#setLocalAddress was a mistake. This parameter
> has nothing to do with request execution.
>
> Please use custom HttpRoutePlanner instead.
>
>
> > 2. Is there an equivalent of LaxRedirectStrategy? or
> > DefaultRedirectStrategy is now the equivalent which seems to be
> > the case ?
>
> DefaultRedirectStrategy should now cover all common cases. Lax strategy
> implementation is now superfluous.
>
>
> > 3.
> >
> > PoolingHttpClientConnectionManager does not expose anymore the
> > HttpClientConnectionOperator, it's a protected constructor. In
> > JMeter we
> > use this to compute connect time. It looks like we would need to
> > extend
> > PoolingHttpClientConnectionManager, is there another better way to
> > keep
> > this ?
>
>
> No, this is the intended way.
>
>
> > 4.
> >
> > Regarding bandwidth measurement per request, we used this approach
> > based
> > on your SO answer (
> >
> >
> https://stackoverflow.com/questions/26166469/measure-bandwidth-usage-with-apache-httpcomponents-httpclient
> > ):
> >
> >
> > -
> >
> >
> https://github.com/apache/jmeter/blob/master/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java#L448
> > - Is it still ok using
> >
> > preProcess/postProcess by redefining them in an extension of
> > HttpRequestExecutor and access endpointdetails through:
> > -
> >
> > HttpCoreContext.*adapt*(context).getEndpointDetails();
> >
> > But I don't see any more reset(), so how should we proceed ?
> >
> >
>
> There is no #reset method. We could add but I am not sure if you really
> need it at all. If you need the total bytes sent / received and the
> total number of requests / responses those details are provided by
> HttpConnectionMetrics interface.
>
> Hope this helps
>
> Oleg
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>
--
Cordialement
Philippe M.
Ubik-Ingenierie
Re: Migration from HC4 to HC5 : few questions
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Wed, 2020-07-01 at 19:03 +0200, Philippe Mouawad wrote:
> Hello Oleg,
> Sorry for late reply, this mail was in my drafts, while I thought I
> had
> sent it.
>
> *Thank you for your detailed answers and rapid feedback.*
> All this helps a lot !
>
> Regarding HttpConnectionMetrics, since we need metrics per request
> and not
> per connection, my understanding is that we would need a reset
> method, do I
> understand well ?
> Regards
> Philippe
Hi Philippe
I think what you need to do is to copy values from
HttpConnectionMetrics and do a simple calculation to determine the
number of bytes sent and received by the current message exchange.
Oleg
>
>
> On Thu, Jun 11, 2020 at 12:35 PM Oleg Kalnichevski <ol...@apache.org>
> wrote:
>
> > On Wed, 2020-06-10 at 19:11 +0200, Philippe Mouawad wrote:
> > > Hello,
> > > I am looking into migrating Apache JMeter project from HC4 to HC5
> > > to
> > > benefit from the new features for Classic HttpClient like the
> > > new
> > > lax
> > > connection pool and performance improvements.
> > > In the future we would hopefully switch to Async.
> > >
> > > First thanks for this documentation, very useful ! :
> > >
> >
> >
https://ok2c.github.io/httpclient-migration-guide/migration-to-classic.html
> > >
> > > Few questions:
> > >
> > > 1. I don't see an equivalent of
> > > RequestConfig.Builder#setLocalAddress ?
> > > How do we get this feature ?
> >
> > RequestConfig.Builder#setLocalAddress was a mistake. This
> > parameter
> > has nothing to do with request execution.
> >
> > Please use custom HttpRoutePlanner instead.
> >
> >
> > > 2. Is there an equivalent of LaxRedirectStrategy? or
> > > DefaultRedirectStrategy is now the equivalent which seems to
> > > be
> > > the case ?
> >
> > DefaultRedirectStrategy should now cover all common cases. Lax
> > strategy
> > implementation is now superfluous.
> >
> >
> > > 3.
> > >
> > > PoolingHttpClientConnectionManager does not expose anymore the
> > > HttpClientConnectionOperator, it's a protected constructor. In
> > > JMeter we
> > > use this to compute connect time. It looks like we would need
> > > to
> > > extend
> > > PoolingHttpClientConnectionManager, is there another better
> > > way to
> > > keep
> > > this ?
> >
> >
> > No, this is the intended way.
> >
> >
> > > 4.
> > >
> > > Regarding bandwidth measurement per request, we used this
> > > approach
> > > based
> > > on your SO answer (
> > >
> > >
> >
> >
https://stackoverflow.com/questions/26166469/measure-bandwidth-usage-with-apache-httpcomponents-httpclient
> > > ):
> > >
> > >
> > > -
> > >
> > >
> >
> >
https://github.com/apache/jmeter/blob/master/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java#L448
> > > - Is it still ok using
> > >
> > > preProcess/postProcess by redefining them in an extension
> > > of
> > > HttpRequestExecutor and access endpointdetails through:
> > > -
> > >
> > > HttpCoreContext.*adapt*(context).getEndpointDetails();
> > >
> > > But I don't see any more reset(), so how should we proceed
> > > ?
> > >
> > >
> >
> > There is no #reset method. We could add but I am not sure if you
> > really
> > need it at all. If you need the total bytes sent / received and the
> > total number of requests / responses those details are provided by
> > HttpConnectionMetrics interface.
> >
> > Hope this helps
> >
> > 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