RIFE2 v1.3.0 with GraalVM native-image AOT compilation support
-
RIFE2 v1.3.0 now supports Ahead-Of-Time compilation with GraalVM native-image, keeping your startup time and memory footprint low by doing the heavy lifting up-front.
In order to try this out, please download the latest GraalVM JDK 19 distribution, and follow the steps to install
native-image
on your machine. https://www.graalvm.org/dev/reference-manual/native-image/Once that is done, package your application as an UberJar and create a single native executable using the following command:
native-image --no-fallback --enable-preview -jar your-uber.jar
You'll be able to launch it with:
./your-uber
The RIFE2 bootstrap project is fully setup for AOT compilation, so you start there.
Below is a screenshot and with statistics of a micro-benchmark I did on my AMD Ryzen 9 5950X 16 Core 128GB dedicated Linux server.
Key points:
- application startup in 3ms
- standalone native executable size is 38MB
- using
siege
locally with a concurrency of 10 x 2000 requests, gives ~33898 trans/sec - after the test, used up 281.7MB RES and 24.8MB SHR memory, account for 0.2% of memory
In comparison, launching the Uber jar with the JVM:
- application startup in 177ms
- uber jar size is 4.7MB but requires a separate JVM installation
- using
siege
locally with a concurrency of 10 x 2000 requests, gives ~44444 trans/sec - after the test, used up 1.7GB RES and 39.7MB SHR memory, account for 1.3% of memory
NOTE: RIFE2 support for GraalVM native-image is still in preliminary stages. There's no solution yet to replace the features of the RIFE2 Java agent, and it's only been tested in a limited context. When expanding the code of the project, you most likely will have to update the native-image configuration files located in
app/src/main/resources/META-INF/native-image
.
More information about that can be found in the GraalVM manual.