# Checkpoint/restore streamer

The Cedana daemon supports checkpoint/restore via high-performance low-overhead streaming. It's powered by the [streamer plugin](https://github.com/cedana/cedana-image-streamer), which is a fork of CRIU's [image streamer](https://github.com/checkpoint-restore/criu-image-streamer).

{% hint style="info" %}
Real benefits of streaming are realized only when checkpointing and restoring to/from a remote location. See [remote storage](#remote-storage).
{% endhint %}

## Prerequisites

1. Create an account with Cedana, to get access to the streamer plugin. See [authentication](/daemon/get-started/authentication.md).
2. Set the Cedana URL & authentication token in the [configuration](/daemon/get-started/configuration.md).
3. Install the streamer plugin with `sudo cedana plugin install streamer`.
4. Ensure the daemon is running, see [installation](/daemon/get-started/installation.md).
5. Do a health check to ensure the plugin is ready, see [health checks](/daemon/get-started/health.md).

## Checkpoint

The `cedana dump` subcommand supports a `--streams <n>` flag, where `n` is the number of parallel streams to use (minimum of 2). For example:

```sh
cedana dump process <pid> --streams 4
```

This will directly stream the checkpoint to a directory, using 4 parallel streams. You will notice that the checkpoint directory contains 4 separate image files:

```
-rw-r--r-- 1 root root 145K Feb 19 15:13 img-0
-rw-r--r-- 1 root root  17K Feb 19 15:13 img-1
-rw-r--r-- 1 root root 209K Feb 19 15:13 img-2
-rw-r--r-- 1 root root 188K Feb 19 15:13 img-3
```

## Restore

The `cedana restore` will automatically detect if the checkpoint was taken with streaming, and will use the same number of streams to restore. For example:

```sh
cedana restore process --path <path-to-dump>
```

## Compression

All compression algorithms supported for basic checkpoint/restore are supported. See [compression](/daemon/checkpoint-restore/cr.md#compression) for more information.

## Remote storage

Cedana supports streaming to/from remote storage, through storage plugins. Check out the following guides for specific remote storage:

* [Amazon S3](/daemon/storage/s3.md)
* [Google Cloud Storage](/daemon/storage/gcs.md)
* [Cedana Storage](/daemon/storage/cedana.md)

{% hint style="info" %}
The daemon simply reads/writes from the filesystem. This is also the case for streaming, with the additional requirement that the underlying filesystem must be [POSIX-compliant](https://grimoire.carcano.ch/blog/posix-compliant-filesystems/). To checkpoint/restore to/from a remote directory, you can also use a FUSE-based filesystem mount backed by your network storage. For Amazon's S3, check out [s3fs-fuse](https://github.com/s3fs-fuse/s3fs-fuse).
{% endhint %}

## Enable by default

To enable streaming by default, set the `Checkpoint.Stream` field in the [configuration](/daemon/get-started/configuration.md) to the desired number of parallel streams. Zero means no streaming.

{% hint style="info" %}
For all available CLI options, see [CLI reference](/daemon/references/cli/cedana.md). Directly interacting with daemon is also possible through gRPC, see [API reference](/daemon/references/api.md).
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cedana.ai/daemon/checkpoint-restore/cr-4.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
