jmeter-http2-sampler

0
2 года назад
2 года назад
2 года назад
2 года назад
2 года назад
2 года назад
2 года назад
README.md

HTTP2 Plugin for JMeter

Inspired by BlazeMeter HTTP2 Plugin but with JDK11+ HTTPClient under hood + GraphQL Sampler

This plugin provides an HTTP2 Sampler and a HTTP2 Controller in order to test you HTTP/2 endpoint.

IMPORTANT: Java 21 required

To create your test:

  1. Install the HTTP/2 plugin jar library to lib/ext.

  2. Create a Thread Group.

  3. Add the HTTP2 Sampler (Add-> Sampler-> HTTP2 Request).

After that you can add timers, assertions, listeners, etc.

Configuring the HTTP2 Sampler:

Let's explain the HTTP2 Sampler fields:

Basic tab:

FieldDescriptionDefault
ProtocolChoose HTTP or HTTPSHTTP
Server name or IPThe domain name or IP address of the web server. [Do not include the http:// prefix.].
Port numberThe port the web server is listening to80
MethodGET, POST, PUT, PATCH, DELETE and OPTIONS are the ones supported at the moment.
PathThe path to resource (For example:
/servlets/myServlet
).
Content EncodingContent encoding to be used (for POST, PUT, PATCH and FILE). This is the character encoding to be used, and is not related to the Content-Encoding HTTP header.
Redirect AutomaticallySets the underlying HTTP protocol handler to automatically follow redirects, so they are not seen by JMeter, and therefore will not appear as samples.
Follow RedirectsIf set, the JMeter sampler will check if the response is a redirect and will follow it. The initial redirect and further responses will appear as additional samples.
Use multipart/form-dataUse a
multipart/form-data
or
application/x-www-form-urlencoded
post request
HTTP1 UpgradeEnables the usage of the Upgrade header for HTTP1 request. (Not enabling this sets HTTP2 as default).

Advanced tab:

FieldDescriptionDefault
Timeouts (milliseconds):
ConnectNumber of milliseconds to wait for a connection to open.
ResponseThe number of milliseconds to wait for a response.
Proxy Server:
SchemeThe scheme identifies the protocol to be used to access the resource on the Internet.http
Server name or IPHostname or IP address of a proxy server to perform request. [Do not include the http:// prefix].
Port NumberPort the proxy server is listening to.
Retrieve All Embedded ResourcesAllows JMeter to parse the HTML file and send HTTP/HTTPS requests for all images, Java applets, JavaScript files, CSSs, etc. referenced in the file.
Parallel downloadsThis feature allows the settings of a concurrent connection pool for retrieving embedded resources as part of the HTTP sampler.
URLs must matchEnables to filter the download of embedded resources that don't match the regular expression set on it. For example, setting this regex
http:\/\/example\.invalid\/.*
, will only download the embedded resources that comes from
http://example.invalid/
.

HTTP/1 Upgrade

When HTTP/1 Upgrade is selected means that the first request made by the plugin will contain all required headers for http1 upgrade.

However, there is a known issue which will send the upgrade when receiving an HTTP1 response even thought the option of HTTP1 Upgrade is not selected. Additionally after the first request which may contain upgrade headers or not (depending on user selection) afterwards all HTTP/1.1 requests made as long as the server responds in HTTP/1.1 will contain upgrade headers.

Buffer capacity

By default, the size of the downloaded resources is set to 2 MB (2097152 bytes) but, the limit can be increased by adding the

httpJettyClient.maxBufferSize
property on the jmeter.properties file in bytes.

ALPN

The HTTP2 plugin offers Application-Layer Protocol Negotiation (ALPN) support, which facilitates the negotiation of application-layer protocols within the TLS handshake. This enables smooth communication between the client and server by allowing them to agree upon the protocols to be used.

The plugin supports the following protocols for ALPN negotiation:

  • HTTP/1.1
  • HTTP/2 (over TLS)

For TLS/SSL configuration please refer to SSL Manager and Keystore Configuration

Auth Manager

Currently, we only give support to the Basic and Digest authentication mechanism. To make use of Basic preemptive authentication results, make sure to create and set the property

httpJettyClient.auth.preemptive
to true in the jmeter.properties file.

Embedded Resources

To retrieve all embedded resources asynchronously, you simply need to choose "Parallel Downloads" as the option, unless the value is equal to 1. If you would like to download embedded resources in a synchronous way choose "Parallel Downloads" and set the number to 1.