Skip to content

Commit

Permalink
Added support for standards JMeter listeners and partial support for …
Browse files Browse the repository at this point in the history
…push promise (Blazemeter#56)

* Added support for standards JMeter listeners and partial support for push promise

* Fixed compatibility with previous version

* Recover HTTP2 Simple data writer

* Recover HTTP2 Simple data writer (Blazemeter#15)

* Removed HTTP2 Simple data writer from JMeter menu and added BZ logo

* added to HTTP 2 Simple data writer the same behavior than the default simple data writer to avoid misunderstanding

* Fixed removing HTTP2 Simple data writer from menu

* fixed codacy warnings
  • Loading branch information
sebastianlorenzo88 authored and Artem Fedorov committed Jul 20, 2018
1 parent 15f080b commit 87bb3db
Show file tree
Hide file tree
Showing 30 changed files with 3,129 additions and 3,189 deletions.
45 changes: 32 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
language: java

jdk:
- oraclejdk8

before_install:
- curl -O -L https://github.com/inventit/mqtt-websocket-java/releases/download/1.0.1/mqtt-websocket-java-1.0.1.jar
- mvn install:install-file -Dfile=mqtt-websocket-java-1.0.1.jar -DgroupId=io.inventit.dev -DartifactId=mqtt-websocket-java -Dversion=1.0.1 -Dpackaging=jar

install: "mvn -Dmaven.test.skip=true clean install --batch-mode"
script: "mvn -Djava.awt.headless=true -Dmaven.test.redirectTestOutputToFile=true -Dcobertura.report.format=xml --fail-at-end --batch-mode cobertura:cobertura test "

after_success:
env:
global:
- MAVEN_OPTS=-Dmaven.repo.local=.m2/repository
- MQTT_WEBSOCKET_VERSION=1.0.1

cache:
directories:
- .jmeter
- .m2

language: java

jdk:
- oraclejdk8

before_install:
- sudo apt-get -y update
- sudo apt-get -y install python default-jre-headless python-tk python-pip python-dev libxml2-dev libxslt-dev zlib1g-dev net-tools
- sudo pip install bzt==1.11.0
- chmod -R +x ./.travis
- "sh ./.travis/install-maven-dependency.sh https://github.com/inventit/mqtt-websocket-java/releases/download/$MQTT_WEBSOCKET_VERSION/mqtt-websocket-java-$MQTT_WEBSOCKET_VERSION.jar io.inventit.dev mqtt-websocket-java $MQTT_WEBSOCKET_VERSION"


script:
- "mvn -DskipTests=true clean install --batch-mode"
- "mvn -Djava.awt.headless=true -Dmaven.test.redirectTestOutputToFile=true -Dcobertura.report.format=xml --fail-at-end --batch-mode cobertura:cobertura test"
- "sh ./http2/target/jmeter-test/testJMeter.sh 4.0 $HOME/.jmeter"
- "sh ./http2/target/jmeter-test/testJMeter.sh 3.3 $HOME/.jmeter"
- "sh ./http2/target/jmeter-test/testJMeter.sh 3.2 $HOME/.jmeter"
- "sh ./http2/target/jmeter-test/testJMeter.sh 3.1 $HOME/.jmeter"

after_success:
- bash <(curl -s https://codecov.io/bash)
7 changes: 7 additions & 0 deletions .travis/install-maven-dependency.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#/bin/bash
set -ex

if !(mvn dependency:get -Dartifact=$2:$3:$4); then
mvn com.googlecode.maven-download-plugin:download-maven-plugin:1.4.0:wget -Ddownload.url=$1
mvn install:install-file -Dfile=target/${1##*/} -DgroupId=$2 -DartifactId=$3 -Dversion=$4 -Dpackaging=jar
fi
Binary file added http2/Labs_logo_3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 30 additions & 5 deletions http2/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
![](Labs_logo_3x.png)

# HTTP2 Plugin for JMeter

## HTTP2 Sampler for JMeter
Expand All @@ -20,6 +22,7 @@ As Java 8 does not have native support for HTTP/2, you will need to ensure you h
### To create your test:

1 - Create a Thread Group.

2 - Add the HTTP Sampler Add->Sampler->HTTP2 Sampler

![](addHTTP2Sampler.png)
Expand Down Expand Up @@ -59,13 +62,35 @@ Send Parameters With the Request - All the fields are equivalent to HTTP/1.1 fie

### Limitations

HTTP/2 is an asynchronous protocol, meaning we don’t have to wait for the response of the server to continue the communication. But the JMeter model executes synchronously. Therefore, if we want to add assertions or post processors to our HTTP/2 Requests, i. e. process the response, we need to select the checkbox Synchronized Request to indicate that JMeter needs to wait until receiving the response before sending more requests.
HTTP/2 is an asynchronous protocol, meaning we don’t have to wait for the response of the server to continue the communication. But the JMeter model executes synchronously. Therefore, if we want to add assertions or post processors to our HTTP/2 Requests, i. e. process the response, we need to select the checkbox Synchronized Request to indicate that JMeter needs to wait until receiving the response before sending more requests. On the other hand, not having synchronized requests enabled may be useful if we want to simulate the regular HTTP2 communication without waiting for a response every time we send a request. Apart from that, it is possible to execute post processor and assertions over asynchronous requests but there is no guarantee that it works in all cases as is wanted because the context of the execution could be different than the expected. So the only guaranteed assertions that will work as expected will be the ones that use the response data of the executed sampler. The actions to be taken after a Sampler error do not work with asynchronous request

![](syncRequest.png)

### View Result Tree Http2
### Run HTTP2 Plugin on Blazemeter

In order to run HTTP2 plugin on Blazemeter, its required to add the java argument ```-Xbootclasspath/p:<path.to.jar>``` to the JVM that runs jmeter. This can be achieved using a taurus .yaml implemented as following:

```yaml
services:
- module: shellexec
startup:
- chmod +x mod-script.sh && ./mod-script.sh
execution:
- scenario: scenario_name
concurrency: 5
iteration: 10
ramp-up: 1m

files:
- alpn-boot-8.1.12.v20180117.jar
- mod-script.sh
scenarios:....
modules:...
```

With the shellexec module, we are allowing taurus to run a shellscript, which will have this command:

The View Results Tree Listener isn’t fit for HTTP/2, which can send more than one request at the same time without waiting for a response. Using the regular listener means we won’t be able to see the responses of all asynchronous requests.
To solve this problem, you can use the View Result Tree Http2. This specialized listener provides a way to visualize a request that has not received a response yet. These requests will be written in blue, as you can see in the image below. When the response is received, the writing will turn immediately to black, and you will be able to see the response message.
```bash
sed -i "s/^java /java -Xbootclasspath\/p:alpn-boot-8.1.12.v20180117.jar /" ~/.bzt/jmeter-taurus/3.3/bin/jmeter.sh
```

![](viewResultTree.png)
Loading

0 comments on commit 87bb3db

Please sign in to comment.