Pasha Finkelshteyn

CRaCing Java Snapshots

What if you could launch a fully warmed-up Java application in milliseconds? Discover how CRaC snapshots make it possible.

CRaCing Java Snapshots
#1about 1 minute

The problem of slow Java application startup times

Slow application startups can hinder development and deployment, especially when fast rollbacks are needed.

#2about 3 minutes

Introducing CRIU for process snapshotting in Linux

Checkpoint/Restore In Userspace (CRIU) is a Linux utility that can snapshot a running process's memory to disk for later restoration.

#3about 2 minutes

Understanding the limitations of generic CRIU with complex apps

Generic CRIU can fail to correctly restore complex applications like htop or a JVM because it lacks application-specific state awareness.

#4about 3 minutes

Introducing CRaC as a JVM-specific solution for fast startups

Coordinated Restore at Checkpoint (CRaC) is a Linux-only, JVM-aware technology built on CRIU that enables near-instant application startup.

#5about 4 minutes

Creating a basic CRaC snapshot using Docker

To create a CRaC snapshot in Docker, you need a CRaC-enabled JDK and specific container capabilities like cap_sys_ptrace and cap_checkpoint_restore.

#6about 3 minutes

Using JCMD to trigger a checkpoint and restore an image

The jcmd utility triggers the checkpoint on a running Java process, and the resulting container state is committed to a new image for fast restoration.

#7about 3 minutes

Applying CRaC to a real-world Spring Boot application

Spring Boot 3.2 and later have built-in support for CRaC, allowing you to snapshot and restore complex applications like Spring PetClinic.

#8about 6 minutes

Handling custom resources and open connections for CRaC

For resources like network connections that CRaC doesn't manage, implement the Resource interface with beforeCheckpoint and afterRestore methods to handle state correctly.

#9about 1 minute

Summary of the CRaC workflow and key takeaways

The workflow involves building a JAR, running it with checkpoint flags, triggering the snapshot with jcmd, committing the image, and managing custom resources.

Related jobs
Jobs that call for the skills explored in this talk.

Featured Partners

Related Articles

View all articles
Christina Schaireiter
Why Attend a Developer Event?
Modern software engineering moves too fast for documentation alone. Attending a world-class event is about shifting from tactical execution to strategic leadership. Skill Diversification: Break out of your specific tech stack to see how the industry...
Why Attend a Developer Event?

From learning to earning

Jobs that call for the skills explored in this talk.

JAVA Full Stack Developer

Cognizant Technology Solutions Corporation
Springfield, United States of America

Remote
$60-93K
API
CSS
HTML
+8
JAVA Full Stack Developer

Cognizant Technology Solutions Corporation
Providence, United States of America

Remote
$60-93K
API
CSS
HTML
+8
JAVA Full Stack Developer

Cognizant Technology Solutions Corporation
Columbia, United States of America

Remote
$60-93K
API
CSS
HTML
+8
JAVA Full Stack Developer

Cognizant Technology Solutions Corporation
Little Rock, United States of America

Remote
$60-93K
API
CSS
HTML
+8
JAVA Full Stack Developer

Cognizant Technology Solutions Corporation
Sacramento, United States of America

Remote
$60-93K
API
CSS
HTML
+8
JAVA Full Stack Developer

Cognizant Technology Solutions Corporation
Des Moines, United States of America

Remote
$60-93K
API
CSS
HTML
+8
JAVA Full Stack Developer

Cognizant Technology Solutions Corporation
Baton Rouge, United States of America

Remote
$60-93K
API
CSS
HTML
+8