Skip to content

Example Java HttpClient, built as binary, using Graal, native-image, and Maven.

License

Notifications You must be signed in to change notification settings

abargnesi/http-client-graal-native

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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).

About

Example Java HttpClient, built as binary, using Graal, native-image, and Maven.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages