On Fri, 2018-04-20 at 11:40 +0200, Philippe Mouawad wrote:
> Hello Oleg,
> Thanks for rapid answer.
> The body size including entity.
> 


Should this number represent raw bytes (including the size of transfer
encoding elements) or content bytes only (same of Content-Length when
present)?

It would be much easier if you took the size of the entire message.

Oleg



> I'd like the header size to be aside, I already know how to compute
> header
> size.
> 
> Regards
> 
> 
> On Fri, Apr 20, 2018 at 11:21 AM, Oleg Kalnichevski <ol...@apache.org
> >
> wrote:
> 
> > On Fri, 2018-04-20 at 11:09 +0200, Philippe Mouawad wrote:
> > > Hello ,
> > > 
> > > In current Live version of JMeter we use this way of computing
> > > size
> > > of
> > > responses for each request:
> > > 
> > >    -
> > >    https://github.com/apache/jmeter/blob/v4_0/src/protocol/http/o
> > > rg/a
> > > pache/jmeter/protocol/http/sampler/HTTPHC4Impl.java#L888
> > > 
> > > 
> > > As we migrated to last APIs we based implementation on this SO
> > > response
> > > from Oleg:
> > > 
> > >    -
> > >    https://stackoverflow.com/questions/26166469/measure-bandwidth
> > > -usa
> > > ge-with-apache-httpcomponents-httpclient
> > > 
> > > And ended up with this:
> > > 
> > >    -
> > >    https://github.com/apache/jmeter/blob/trunk/src/protocol/http/
> > > org/
> > > apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java#L382
> > > 
> > > But it appears that computation is wrong and we would need to do
> > > this
> > > to be
> > > correct:
> > > 
> > >         protected HttpResponse doReceiveResponse(
> > >                 final HttpRequest request,
> > >                 final HttpClientConnection conn,
> > >                 final HttpContext context) throws HttpException,
> > > IOException {
> > >             HttpResponse response =
> > > super.doReceiveResponse(request,
> > > conn,
> > > context);
> > >             HttpConnectionMetrics metrics = conn.getMetrics();
> > >             HttpEntity entity = response.getEntity();
> > >             context.setAttribute(CONTEXT_ATTRIBUTE_RECEIVED_BYTES
> > > ,
> > >                     metrics.getReceivedBytesCount()+
> > >                     (entity != null ? entity.getContentLength():
> > > 0L));
> > >             metrics.reset();
> > >             return response;
> > >         }
> > > 
> > 
> > Philippe
> > 
> > Are you trying to calculate the size of an entire response (message
> > head + message entity body) or a response entity only?
> > 
> > Oleg
> > 
> > > 
> > > Is my understanding correct ? or am I missing something ?
> > > 
> > > Thanks
> > > 
> > > Regards
> > 
> > -----------------------------------------------------------------
> > ----
> > To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
> > For additional commands, e-mail: httpclient-users-h...@hc.apache.or
> > g
> > 
> > 
> 
> 

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

Reply via email to