HTTP Benchmark Example

Step 1—new benchmark

Run the following command to create the Java version of the example benchmark program:

  • jbang tulip-cli@wfouche init Java

This command creates various files and directories:

├── benchmark_config.json
├── io
│   └── tulip
│       ├── App.java
│       └── HttpUser.java
├── run_bench.cmd
└── run_bench.sh

Step 2—run benchmark

Run script run_bench.sh (Linux or macOS), or run_bench.cmd (Windows) to start the benchmark program.

While the benchmark program is running the benchmark_output.json file is incrementally updated with benchmark results.

Step 3—view results

├── benchmark_config.adoc
├── benchmark_config.json
├── benchmark_output.json
├── benchmark_report.html
├── io
│   └── tulip
│       ├── App.java
│       └── HttpUser.java
├── run_bench.cmd
└── run_bench.sh

Once the benchmark is finished, a benchmark report is automatically generated from the benchmark_output.json file. The benchmark report file is called benchmark_report.html. The benchmark script displays the benchmark report on the console using the lynx text web browser utility (as shown below).

image demo benchmark report console

Open the benchmark_report.html file in a browser to view the benchmark results.

image demo benchmark report html

Step 4—view configuration

The configuration report is stored in file benchmark_config.adoc. Convert this file to html with command:

  • jbang run asciidoc@wfouche benchmark_config.adoc

├── benchmark_config.adoc
├── benchmark_config.html
├── benchmark_config.json
├── benchmark_output.json
├── benchmark_report.html
├── io
│   └── tulip
│       ├── App.java
│       └── HttpUser.java
├── run_bench.cmd
├── run_bench.sh

View the configuration report file benchmark_config.html in a browser.

image demo benchmark config report 1

Fatjar Packaging

The demo benchmark can be packaged into a single self-contained JAR file using command:

  • jbang export fatjar io/tulip/App.java

The benchmark program and runtime are packaged into jar file App-fatjar.jar and can then be run with command:

  • java -jar App-fatjar.jar, or with additional JVM settings as

  • java -server -Xms2g -Xmx2g -XX:+UseZGC -XX:+ZGenerational -jar App-fatjar.jar

Files App-fatjar.jar and benchmark_config.json can be copied to another machine if the benchmark program needs to be run elsewhere.