Skip to content

Latest commit

 

History

History
98 lines (74 loc) · 3.62 KB

crac.md

File metadata and controls

98 lines (74 loc) · 3.62 KB

Showcase SpringBoot 3.2 automatic checkpoint at start on Linux

Setup the environment

  1. Download a JDK with support for CRaC e.g.
  1. Unpack the tar.gz file and copy the JDK in a folder
  • sudo tar zxvf zulu21.30.19-ca-crac-jdk21.0.1-linux_x64.tar.gz
  • mv zulu21.30.19-ca-crac-jdk21.0.1-linux_x64 zulu-21.jdk
  • sudo mv zulu-21.jdk /usr/lib/jvm
  1. Set the $JAVA_HOME environment variable to the JDK with CRaC support e.g.
  • export JAVA_HOME=/usr/lib/jvm/zulu-21.jdk
  1. 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
  1. Make sure you have the dependency to org.crac added to your build file
  • gradle:
    implementation 'org.crac:crac:1.4.0'
  • maven :
<dependency>
  <groupId>org.crac</groupId>
  <artifactId>crac</artifactId>
  <version>1.4.0</version>
</dependency>  



Build the application

  1. Open the project folder
  2. run gradlew clean build
  3. Now you should find the the jar at build/libs/spring-petclinic-3.2.0.jar
  4. Create a folder named tmp_auto_checkpoint in the project folder (besides the src folder)
  5. Create a folder named tmp_manual_checkpoint in the project folder (besides the src folder)



Start the application without any CRaC

  1. Start the application normally bash start.sh

Info:

A checkpoint can also be compressed (only in Azul Zulu) on the hard drive by executing export CRAC_CRIU_OPTS=--compress It is already in the two shell scripts for starting up the app with the different options

  • start-auto-crac.sh
  • start-manual-crac.sh So you simply have to un-comment it in these shell scripts. 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)

Start the application and automatically create a checkpoint after the framework startup

  1. Make sure the folder tmp_auto_checkpoint exists
  2. Remove all files from the folder tmp_auto_checkpoint with rm ./tmp_auto_checkpoint/*.*
  3. Start the application and automatically create a checkpoint bash start-auto-crac.sh

Restore the application from the automatically created checkpoint

  1. Restore the application from the stored checkpoint bash restore-auto-crac.sh



Start the application and create a checkpoint manually after application startup

  1. Make sure the folder tmp_manual_checkpoint exists
  2. Remove all files from the folder tmp_manual_checkpointwith rm ./tmp_manual_checkpoint/*.*
  3. Start the application bash start-manual-crac.sh

Create the manual checkpoint

There are two ways of creating the checkpoint manually, calling the application jar or the pid

  1. Calling the application jar jcmd spring-petclinic-3.2.0.jar JDK.checkpoint

or

  1. Executing the create-manual-checkpoint.sh script with the PID (can be found in the output in the 1st shell window) bash create-manual-checkpoint.sh PID

  2. Check if the checkpoint files have been stored in ./tmp_manual_checkpoint


Restore the application from the manually created checkpoint

  1. Restore the application from the stored checkpoint by executing bash restore-manual-crac.sh