Difference between revisions of "Lazy migration"

From CRIU
Jump to navigation Jump to search
 
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:Plans]]
+
== Overview ==
[[Category:Empty articles]]
+
Lazy, or [[wikipedia:Live_migration#Post-copy_memory_migration|post-copy memory migration]], allows to minimize application downtime. Unlike [[wikipedia:Live_migration#Pre-copy_memory_migration|pre-copy memory migration]], lazy migration does not copy the task's memory, but rather keeps the memory pages at the source node. Only the minimal task state required to start the application is copied to the destination node and the task is resumed there. When the task accesses missing memory pages, <code>criu</code> processes the page faults, transfers the required page from the source node and injects it into the running task address space.
 +
 
 +
== Using Lazy Migration ==
 +
 
 +
=== Dump ===
 +
The <code>dump</code> action should be invoked with <code>--lazy-pages</code> option. In addition, <code>--address</code> and <code>--port</code> options may be used to select IP address and port that will be serving the page requests
 +
 
 +
[src]# criu dump --tree <pid> --images-dir <dir> --lazy-pages --address <src> --port <port>
 +
 
 +
=== Copy images ===
 +
Copy the images onto the destination node:
 +
 
 +
[src]# scp -r <dir> <dst-node>/<dir>
 +
 
 +
The images do not contain the massive bulk of the memory dump, they are relatively small and the copy won't take long.
 +
 
 +
=== Lazy-pages Daemon ===
 +
The <code>lazy-pages</code> daemon is responsible for handling the task's page faults and injecting the memory pages into the task's address space. The <code>--page-server</code> option should be set so that <code>lazy-pages</code> daemon will connect to the '''src''' node. The <code>--address</code> and <code>--port</code> options should be used to define the IP address and port of the <code>dump</code> side.
 +
 
 +
[dst]# criu lazy-pages --images-dir <dir> --page-server --address <src> --port <port>
 +
 
 +
=== Restore ===
 +
The <code>restore</code> should be run with <code>--lazy-pages</code> option
 +
 
 +
[dst]# criu restore --images-dir <dir> --lazy-pages
 +
 
 +
Note, that <code>lazy-pages</code> and <code>restore</code> must be run in the same working directory, or <code>--work-dir</code> option should be explicitly set.
 +
 
 +
=== Video ===
 +
 
 +
To view an example video of using a lazy-pages, please go to https://asciinema.org/a/4QgtYPW9XtTngTyCX5Jsibqth
 +
 
 +
== See also ==
 +
 
 +
* [[Userfaultfd]]
 +
* [[Live migration]]
 +
* [[Iterative migration]]
 +
 
 +
 
 +
[[Category:New features]]
 +
[[Category:Live migration]]

Latest revision as of 11:10, 24 April 2018

Overview[edit]

Lazy, or post-copy memory migration, allows to minimize application downtime. Unlike pre-copy memory migration, lazy migration does not copy the task's memory, but rather keeps the memory pages at the source node. Only the minimal task state required to start the application is copied to the destination node and the task is resumed there. When the task accesses missing memory pages, criu processes the page faults, transfers the required page from the source node and injects it into the running task address space.

Using Lazy Migration[edit]

Dump[edit]

The dump action should be invoked with --lazy-pages option. In addition, --address and --port options may be used to select IP address and port that will be serving the page requests

[src]# criu dump --tree <pid> --images-dir <dir> --lazy-pages --address <src> --port <port>

Copy images[edit]

Copy the images onto the destination node:

[src]# scp -r <dir> <dst-node>/<dir>

The images do not contain the massive bulk of the memory dump, they are relatively small and the copy won't take long.

Lazy-pages Daemon[edit]

The lazy-pages daemon is responsible for handling the task's page faults and injecting the memory pages into the task's address space. The --page-server option should be set so that lazy-pages daemon will connect to the src node. The --address and --port options should be used to define the IP address and port of the dump side.

[dst]# criu lazy-pages --images-dir <dir> --page-server --address <src> --port <port>

Restore[edit]

The restore should be run with --lazy-pages option

[dst]# criu restore --images-dir <dir> --lazy-pages

Note, that lazy-pages and restore must be run in the same working directory, or --work-dir option should be explicitly set.

Video[edit]

To view an example video of using a lazy-pages, please go to https://asciinema.org/a/4QgtYPW9XtTngTyCX5Jsibqth

See also[edit]