> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Checkpoint an Atoti application

First, if you want to be able to snapshot your application, you must provide the path of the generated checkpoint when
you launch your Java application with the following VM argument:

```
java -XX:CRaCCheckpointTo=/path/to/crac/image -jar myApp.jar
```

Generate a checkpoint, whether:

* Manually from outside the application with the following command: `jcmd <myApp.jar/PID> JDK.checkpoint`.<br />
  The execution of this command ends quickly but your application is still paused while its state is being copied to the
  disk.
* Automatically after Spring initialization but right before the application is started by adding this system property
  while launching your application: `-Dspring.context.checkpoint=onRefresh`.<br />
  It is not recommended as manual checkpoints usually provide better performance, as explained in the
  [official documentation](https://docs.azul.com/core/crac/crac-frameworks#spring-manual).
* Programmatically within your application with the CRaC API: `org.crac.Core.checkpointRestore()`.<br />
  This method triggers a checkpoint and returns when the restore is completed.

<Warning>
  Do not try to manually close the application during the checkpoint process.
</Warning>

If you need the CRaC API, you must import the dependency in your project with Maven:

```
<dependency>
	<groupId>org.crac</groupId>
	<artifactId>crac</artifactId>
	<version>${crac.version}</version>
</dependency>
```

The version is defined by Spring Boot.

See the [official guide to running CRaC in Docker](https://docs.azul.com/core/crac/crac-guidelines#run-in-container).
