Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference in response time between HTTPclient 3.1 and HTTP client 4 in jmeter

i am testing my website using HTTPS. The response time is higher when i used the default implementation. The response time is getting reduced if i use implementation as HTTPclient 3.1. Why there is a difference in response time between HTTPclient 4 and HTTPclient 3.1? To test my website with https, do i need to use HTTPclient 4 or HTTPclient 3.1 ? Which will provide me the exact response time as like in browser?

Below is my sample test plan,

enter image description here

like image 797
Praju Avatar asked Dec 25 '22 13:12

Praju


2 Answers

As per HTTP Request documentation

HTTP Request - this has an implementation drop-down box, which selects the HTTP protocol implementation to be used: Java - uses the HTTP implementation provided by the JVM. This has some limitations in comparison with the HttpClient implementations - see below. HTTPClient3.1 - uses Apache Commons HttpClient 3.1. This is no longer being developed, and support for this may be dropped in a future JMeter release. HTTPClient4 - uses Apache HttpComponents HttpClient 4.x. Blank Value - does not set implementationon HTTP Samplers, so relies on HTTP Request Defaults if present or on jmeter.httpsampler property defined in jmeter.properties The Java HTTP implementation has some limitations: There is no control over how connections are re-used. When a connection is released by JMeter, it may or may not be re-used by the same thread. The API is best suited to single-threaded usage - various settings are defined via system properties, and therefore apply to all connections. There is a bug in the handling of HTTPS via a Proxy (the CONNECT is not handled correctly). See Java bugs 6226610 and 6208335. It does not support virtual hosts.

It's better to use HTTPClient4 implementation.

However if you need your requests to be as much like a real browser as possible you need to consider using following components:

  • In HTTP Request Defaults tell JMeter to retrieve all embedded resources and do in using thread pool of 2-5 requests (as real browsers do)
  • Use HTTP Cookie Manager - to simulate browser cookies and to deal with cookie-based authentication
  • Use HTTP Header Manager - to set user agent string, content type, accept language, etc. headers.
  • Use HTTP Cache Manager - to simulate browser cache
like image 107
Dmitri T Avatar answered Jan 04 '23 17:01

Dmitri T


Benchmarks I made against local site in HTTPs didn't at all confirm what is being said here.

HttpClient 4 is even now faster than HttpClient 3.1 particularly since 2.10 which fixed an issue in this area:

  • https://issues.apache.org/bugzilla/show_bug.cgi?id=55023

And even more with 2.11 which made performance improvements:

  • https://issues.apache.org/bugzilla/show_bug.cgi?id=55857

  • https://issues.apache.org/bugzilla/show_bug.cgi?id=55865

Also as you can see issue referred to by Dmitri is closed as "Not an issue" as reported problem was wrong.

If you confirm you are not in the cases described in the JIRA, then describing how you are leading your test might help.

like image 28
UBIK LOAD PACK Avatar answered Jan 04 '23 17:01

UBIK LOAD PACK