Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lxc-checkpoint: enable dirty memory tracking in criu #1299

Merged
merged 1 commit into from
Nov 15, 2016

Conversation

adrianreber
Copy link
Contributor

CRIU supports dirty memory tracking to take incremental checkpoints.
Incremental checkpoints are one way of reducing downtime during
migration. The first checkpoint dumps all the memory pages and the
second (and third, and fourth, ...) only dumps pages which have changed.

Most of the necessary code has already been implemented. This just adds
the existing functionality to lxc-checkpoint:

-p, --pre-dump Only pre-dump the memory of the container.
Container keeps on running and following
checkpoints will only dump the changes.
--predump-dir=DIR path to images from previous dump (relative to -D)

The following is an example from a container running CentOS 7 with psql
and tomcat:

lxc-checkpoint -n c7 -D /tmp/cp -p

Container keeps on running

du -h /tmp/cp

229M /tmp/cp
Sync initial checkpoint to destination

rsync -a /tmp/cp host2:/tmp/

Sync file-system

rsync -a /var/lib/lxc/c7 host2:/var/lib/lxc/

Final dump; container is stopped

lxc-checkpoint -n c7 -D /tmp/cp --predump-dir=../cp -s

du -h /tmp/cp2

90M /tmp/cp2

After transferring the second (incremental checkpoint) and the changes
to the container's file system the container can be restored on the
second host by pointing lxc-checkpoint to the second checkpoint
directory:

lxc-checkpoint -n c7 -D /tmp/cp2 -r

Signed-off-by: Adrian Reber areber@redhat.com

@lxc-jenkins
Copy link

This pull request didn't trigger Jenkins as its author isn't in the whitelist.

An organization member must perform one of the following:

  • To have this branch tested by Jenkins, use the "ok to test" command.
  • To have a one time test done, use the "test this please" command.

Those commands are simple Github comments of the format: "jenkins: COMMAND"

@adrianreber
Copy link
Contributor Author

It seems my commit messages is formatted by github differently than expected (not at all).

@tych0 This is my preparation for pre-dump support in lxd to easier test the code path.

/* Using --prev-images-dir works in older CRIU versions (2.3).
* For newer CRIU versions like 2.8 --track-mem needs to
* be added to the command-line. */
DECLARE_ARG("--track-mem");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will the parser fail on older versions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, it seems the option is always needed. I just tried it with criu 2.3 which I thought worked without --track-mem. I will update the PR and remove the comment.

@tych0
Copy link
Member

tych0 commented Nov 15, 2016

Other than the one comment, LGTM. We don't currently have any users of this code path, so if it's easier to just merge this as-is to experiment, that's fine with me.

CRIU supports dirty memory tracking to take incremental checkpoints.
Incremental checkpoints are one way of reducing downtime during
migration. The first checkpoint dumps all the memory pages and the
second (and third, and fourth, ...) only dumps pages which have changed.

Most of the necessary code has already been implemented. This just adds
the existing functionality to lxc-checkpoint:

  -p, --pre-dump            Only pre-dump the memory of the container.
                            Container keeps on running and following
                            checkpoints will only dump the changes.
  --predump-dir=DIR         path to images from previous dump (relative to -D)

The following is an example from a container running CentOS 7 with psql
and tomcat:

 # lxc-checkpoint -n c7 -D /tmp/cp -p
Container keeps on running
 # du -h /tmp/cp
 229M	/tmp/cp
Sync initial checkpoint to destination
 # rsync -a /tmp/cp host2:/tmp/
Sync file-system
 # rsync -a /var/lib/lxc/c7 host2:/var/lib/lxc/
Final dump; container is stopped
 # lxc-checkpoint -n c7 -D /tmp/cp --predump-dir=../cp -s
 # du -h /tmp/cp2
 90M	/tmp/cp2

After transferring the second (incremental checkpoint) and the changes
to the container's file system the container can be restored on the
second host by pointing lxc-checkpoint to the second checkpoint
directory:

 # lxc-checkpoint -n c7 -D /tmp/cp2 -r

Signed-off-by: Adrian Reber <areber@redhat.com>
@adrianreber
Copy link
Contributor Author

New version pushed without the comment. --track-mem is now always enabled when --prev-images-dir is used.

@tych0
Copy link
Member

tych0 commented Nov 15, 2016

Ok, cool. +1 then, thanks!

@brauner
Copy link
Member

brauner commented Nov 15, 2016

jenkins: test this please

1 similar comment
@brauner
Copy link
Member

brauner commented Nov 15, 2016

jenkins: test this please

@stgraber stgraber merged commit a8bae55 into lxc:master Nov 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants