http4s + Graal
http4s-graal is an experiment to get http4s web service running as native image with Graal (+ Substrate).
Develop and Compile Dependencies
The following binaries / libraries need to be installed in order to compile the web service (including converting it to native image). The version numbers denotes the specific version used to develop the web service, it may not work under other minor versions:
- Install and configure Graal:
- Download Graal (CE / EE) and extract to a folder of your choice
- Add Graal binaries folder (
- Install SBT:
- Create the uber-jar by running
sbt assemblyon the project root
- Create the native image by running
native-image -H:+ReportUnsupportedElementsAtRuntime -jar target/scala-2.12/http4s-graal-assembly-0.0.1-SNAPSHOT.jar
- Start the web service with
Now you can visit
localhost:8080 from your browser.
./scripts/graal/bin/setup.shto download and setup Graal.
./scripts/graal/bin/dist.shto create a native image distribution under the
Several Dockerfiles have been provided to allow project compilation and packaging, targeting multiple runtime
environments. It utilises multi-stage Docker builds, so no other dependency is required apart from Docker itself.
All containers by default will be accessible at port 9080, e.g.
./scripts/graal/bin/build.sh -i <image> where image is one of the following:
zulu8(default) Azul Zulu 8 on Ubuntu 18.04
zulu11Azul Zulu 11 on Ubuntu 18.04
graalGraalVM on Oracle Linux 7 (slim)
nativeGraal + Substrate native image on Oracle Linux 7 (slim)
NOTE: http4s Docker containers will be constrained to 1 CPU and 4GB of memory.
Container Management and Monitoring
Portainer is an open-source web-based Docker management UI. It allows viewing of container stats in realtime: CPU and memory usage, networking, and processes running in the container.
./scripts/portainer/bin/setup.shto pull the latest Portainer image and create the data volume.
./scripts/portainer/bin/start.shto start the Portainer container:
localhost:9000Portainer web UI
Gatling Load Testing
Gatling is an open-source load and performance testing framework based on Scala, Akka and Netty.
sbt gatling:testto download, setup, and run Gatling load testing simulation(s).
We follow the "feature-branch" Git workflow.
- Commit changes to a branch in your fork (use
- For technical chores, use
chore/prefix followed by the short description, e.g.
- For new features, use
feature/prefix followed by the feature name, e.g.
- For bug fixes, use
bug/prefix followed by the short description, e.g.
- For technical chores, use
- Rebase or merge from "upstream"
- Submit a PR "upstream" to
developbranch with your changes
Please read CONTRIBUTING for more details.
Copyright (c) 2018 Herdy Handoko Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
http4s-graal is released under the Apache Version 2.0 License. See the LICENSE file for further details.