Difference between revisions of "Disk-less migration"

From CRIU
Jump to navigation Jump to search
m
Line 1: Line 1:
When performing a [[live migration]] <code>criu</code> will put image files with applications memory on a storage user provides. If the images with applications' memory are too big, this will result in big delays, due to the need to copy this data several times. Other than this, in some situation it would be desirable to avoid using the storage at all not to increase the load on it. This article describes how one can do [[live migration]] without putting images on disk.
+
When performing a [[live migration]] <code>criu</code> will put image files with applications' memory on a storage user provides. If the images with applications' memory are too big, this will result in big delays, due to the need to copy this data several times. Other than this, in some situations it would be desirable to avoid using the storage at all not to increase the load on it. This article describes how one can do [[live migration]] without putting images on disk.
  
 
; step 1
 
; step 1
Line 8: Line 8:
  
 
; step 2
 
; step 2
: Launch a page server on destination node. The page server will accept pages from <code>criu</code> and will put them into the tmpfs mount. Since we're about to run the apps on destination node, it will ''have'' to bear with this memory consumption. The source node will not have to store these images.
+
: Launch a page server on the destination node. The page server will accept pages from <code>criu</code> and will put them into the tmpfs mount. Since we're about to run the apps on the destination node, it will ''have'' to bear with this memory consumption. The source node will not have to store these images.
  
 
  dst# criu page-server --images-dir <dir> --port <port>
 
  dst# criu page-server --images-dir <dir> --port <port>
  
After this criu will wait for incoming connections to read the apps memory and put them into <code><dir></code>. Note, that if you're going to run through several iterations (see [[iterative migration]] you can make page-server to automatically drop pages, that get re-sent to him with the <code>--auto-dedup</code> option. See the [[incremental dumps]] article for details.
+
After this criu will wait for incoming connections to read the apps memory and put them into <code><dir></code>. Note, that if you're going to run through several iterations (see [[iterative migration]] you can make page-server to automatically drop pages, that get re-sent to it with the <code>--auto-dedup</code> option. See the [[incremental dumps]] article for details.
  
 
; step 3
 
; step 3
: Dump the applications, just like it should be done when doing live migration, but with options explaining to criu where the page server is
+
: Dump the applications, just like it would have been done when doing live migration, but with options explaining to criu where the page server is
  
 
  src# criu dump --tree <pid> --images-dir <dir> --leave-stopped --page-server --address <dst> --port <port>
 
  src# criu dump --tree <pid> --images-dir <dir> --leave-stopped --page-server --address <dst> --port <port>
Line 27: Line 27:
  
 
; step 5
 
; step 5
: Restore the applications. By that time page server mush have stopped (check this by it's ret code) and images with pages are already in the <code><dir></code>.
+
: Restore the applications. By that time page server should have been stopped (check this by it's ret code) and images with pages are already in the <code><dir></code>.
  
 
  dst# criu restore --tree <pid> --images-dir <dir>
 
  dst# criu restore --tree <pid> --images-dir <dir>
Line 37: Line 37:
  
 
; step 7
 
; step 7
: Kill apps on source node, as they are already on the destination one
+
: Kill apps on the source node, as they are already on the destination one
  
 
[[Category: HOWTO]]
 
[[Category: HOWTO]]
 
[[Category: Memory]]
 
[[Category: Memory]]
 
[[Category: Live migration]]
 
[[Category: Live migration]]

Revision as of 14:05, 24 March 2016

When performing a live migration criu will put image files with applications' memory on a storage user provides. If the images with applications' memory are too big, this will result in big delays, due to the need to copy this data several times. Other than this, in some situations it would be desirable to avoid using the storage at all not to increase the load on it. This article describes how one can do live migration without putting images on disk.

step 1
Prepare a tmpfs mount on both sides, where you will put images other than those with apps memory. These images are typically very small and will not create significant memory pressure on nodes.
dst# mount -t tmpfs none <dir>
src# mount -t tmpfs none <dir>
step 2
Launch a page server on the destination node. The page server will accept pages from criu and will put them into the tmpfs mount. Since we're about to run the apps on the destination node, it will have to bear with this memory consumption. The source node will not have to store these images.
dst# criu page-server --images-dir <dir> --port <port>

After this criu will wait for incoming connections to read the apps memory and put them into <dir>. Note, that if you're going to run through several iterations (see iterative migration you can make page-server to automatically drop pages, that get re-sent to it with the --auto-dedup option. See the incremental dumps article for details.

step 3
Dump the applications, just like it would have been done when doing live migration, but with options explaining to criu where the page server is
src# criu dump --tree <pid> --images-dir <dir> --leave-stopped --page-server --address <dst> --port <port>
step 4
Copy rest images onto destination node
src# scp -r <dir> <dst-node>/<dir>

As was said, CRIU images other than those with pages are very small and this won't take long.

step 5
Restore the applications. By that time page server should have been stopped (check this by it's ret code) and images with pages are already in the <dir>.
dst# criu restore --tree <pid> --images-dir <dir>
step 6
Kill the tmpfs mount with old images. It's no longer required
dst# umount <dir>
step 7
Kill apps on the source node, as they are already on the destination one