Introduction
Memory checkpointing takes a snapshot of a container’s CPU memory and GPU memory, and uses it to speed up the startup of future containers. Applications that perform a large amount of work at container start time benefit the most from this process. This is useful for both CPU-only and GPU workloads. For CPU applications, checkpointing can preserve expensive initialization work such as imports, dependency loading, configuration setup, and in-memory state. For GPU applications, it can also preserve model weights, CUDA state, and compiled kernels. For example, ML and LLM frameworks often load large model weights and compile CUDA kernels at container start time, which can take many seconds or minutes. Loading from a checkpoint that already contains this initialized state can skip most of that delay. Since this feature is still in beta, please report all issues to the team via our Discord Community or via Email.How to use
Checkpointing is available in early beta to our customer base. Add the following to yourcerebrium.toml to use it.
- A checkpoint already exists for the current build version.
- Another container instance is already undergoing the checkpointing process.
http://169.254.169.253:8234/checkpoint from inside your container when the container is ready to checkpoint.
If successful, subsequent containers are restored from this checkpoint. You can tell that a container was restored from a checkpoint if it has CEREBRIUM_RESTORED: container restored from checkpoint as the first log line in the container.
A checkpoint is tightly coupled to a single deployment. To disable restoring from checkpoints, remove the POST request and redeploy your application.
You can find several implementations in our Examples repository on GitHub.