What is Maelstrom?
https://github.com/jepsen-io/maelstrom
Gossip Glomers Challenges?
ZIO-Maelstrom?
https://zio-maelstrom.bilal-fazlani.com/
- Maelstrom should be installed and should be available in PATH
- Coursier should be installed and should be available in PATH
- GraalVM Community Edition with native-image tool should be installed
sh
/bash
should be available
This is a template repository. Use the below option to create your own repo using this template.
Using running jar files does not work because they start too slow and the tests timeout. So, we need to compile them to native binaries using graalvm
There are three custom (and useful) commands available on every solution subproject:
-
bootstrap
bootstrap command uses coursier cli to build a fat jar will all dependencies. It also create a maelstrom runner script
testjar.sh
file which can be used to run the jar file via maelstrom with expected load for the challenge.#replace with the challenge you want to package sbt efficient-broadcast-1/bootstrap
You can now run
testjar.sh
script from target directory./efficient-broadcast-1/target/testjar.sh
-
maelstromRunAgent
In order to create a native binary, we first run the java application (single node) with a very small load from maelstrom. Using command
maelstromRunAgent
. This runs with graalvm agent and generates reflection configuration inresources/META-INF/native-image/
Reflection configurations don't change very often. So, we can reuse them for future compilations.
-
nativePackage
After reflection configs are generated, we can now compile the application to a native binary using
nativePackage
command. This task also creates atest.sh
file which can be used to run the native binary via maelstrom with expected load for the challenge.#replace with the challenge you want to compile sbt efficient-broadcast-1/maelstromRunAgent sbt efficient-broadcast-1/nativePackage
You can now run
test.sh
script from target directory./efficient-broadcast-1/target/test.sh
- Take a look at build.sbt to get familiar with the build setup
- This is template tested on MacOS. Linux should be supported too. Windows might require minor tweaks
- You may have to change
nativeImageGraalHome
in build.sbt to point to your graalvm home directory - Recommended to use latest Graalvm CE version