- Setup the environment
- Grant permissions to run CRIU
- Build the application
- Start and initialize the MySQL database+
- Start the application without any CRaC
- Start the application and create a checkpoint manually after application startup
- Create the manual checkpoint
- Restore the application from the manually created checkpoint
-
Download the JDK with CRaC support from Azul Zulu website:
-
Unpack the tar.gz file and copy the JDK in a folder
sudo tar zxvf zulu22.30.13-ca-crac-jdk22.0.1-linux_x64.tar.gz
-
Move to the folder where the JDK installation will be located
mv zulu22.30.13-ca-crac-jdk22.0.1-linux_x64 zulu-22.jdk mv zulu-22.jdk /usr/lib/jvm
-
Set the $JAVA_HOME environment variable to the JDK with CRaC support e.g.
export JAVA_HOME=/usr/lib/jvm/zulu-22.jdk
-
Make sure you have the permissions to run CRIU:
sudo chown root:root $JAVA_HOME/lib/criu
sudo chmod u+s $JAVA_HOME/lib/criu
-
Open the project folder and run:
./mvnw verify
-
Now you should find the
spring-with-crac-0.0.1-SNAPSHOT.jar
jar attarget/
directory -
Create a folder named
tmp_manual_checkpoint
in the project folder (besides thesrc
folder)
sh create-manual-checkpoint.sh <target/spring-with-crac-0.0.1-SNAPSHOT.jar or PID>
-
Start the MySQL database using Docker Compose
docker compose up -d
-
Start the application normally
./mvnw spring-boot:run
Note
|
A checkpoint can also be compressed (only in Azul Zulu) on the hard drive by executing:
|
There is a shell script for starting up the app with CRaC support:
-
start-manual-crac.sh
So you simply have to un-comment it in this shell script. Be aware that the compression at checkpoint and decompression at restoring will take longer. Meaning to say the restore will be slower when using a compressed checkpoint (on my machine used here it takes around 150ms to de-compress the checkpoint)
-
Make sure the folder
tmp_manual_checkpoint
exists -
Remove all files from the folder
tmp_manual_checkpoint
with:rm -f ./tmp_manual_checkpoint/*.*
-
Start the application
sh start-manual-crac.sh
There are two ways of creating the checkpoint manually, calling the application jar or the pid
-
Calling the application jar
jcmd target/spring-with-crac-0.0.1-SNAPSHOT.jar JDK.checkpoint
or executing the
create-manual-checkpoint.sh
script with the PID (can be found in the output in the 1st shell window)sh create-manual-checkpoint.sh target/spring-with-crac-0.0.1-SNAPSHOT.jar
OR
sh create-manual-checkpoint.sh <PID>
-
Check if the checkpoint files have been stored in
./tmp_manual_checkpoint