Skip to content

Latest commit

 

History

History
56 lines (35 loc) · 1.05 KB

README.md

File metadata and controls

56 lines (35 loc) · 1.05 KB

http-client-graal-native

Purpose

Provide a simple example project on how to use GraalVM JDK 11, native-image, and Maven together.

I also wanted to experiment with the Java HttpClient API.

Components

Maven

  • Configures Java 11, native-image, and runs integration tests.

Graal

  • Uses native-image to produce a compiled binary for the application.

Build and Test

Prerequisites:

  1. Install GraalVM.
  2. Install native-image with gu install native-image.

Run mvn clean verify to build http-client binary and run integration tests against it.

Run

The http-client binary is in the target directory after compilation.

Command:

usage: http-client URL COUNT

Examples:

Request the https://example.com website once.

$ http-client https://example.com 1
200

Request the https://example.com one-hundred times then output total time.

$ time target/http-client https://example.com 100 > /dev/null

real    0m0.363s
user    0m1.601s
sys     0m0.281s

License

Licensed under the MIT License (see LICENSE).