Archives

Categories

Xen Saves

A couple of days ago the hardware that is used to host this blog was upgraded – doubling the amount of RAM in the machine. To do this the machine was halted, memtest86+ was run to ensure that the new RAM worked correctly, and then it was booted up again. During that process my ssh session was not stopped! I merely refrained from typing anything until the upgrade was complete.

This is one feature I really like about Xen. It can save the memory image of a running domain to a file and then restart it later. TCP sessions remain open if timeouts have not elapsed. The command xm save can be used to save the state to a file and the command xm restore will restore it.

In Debian the location of the save files is stored in the file /etc/default/xendomains with the variable name XENDOMAINS_SAVE and defaults to /var/lib/xen/save.

A quick experiment with one test domain (running Debian/unstable in 128M of RAM and had just run apt-get dist-upgrade so the memory contents would not be all zeros) showed that gzip -9 would decrease the file to 35% of it’s size at a cost of just over 1 minute of CPU time on a Pentium-M 1.7GHz. But gzip -3 compresses it to 37% and only takes 9 seconds. 9 seconds of CPU time to save 80M of disk space seems a reasonable trade-off.

In my particular case it saves CPU time as the encryption I use for my root filesystem takes more CPU time than gzip -3 so compressing the data saves time. But I don’t expect my case to be common.

Now when Xen is used on a more modern machine with a faster CPU gzip -3 has the potential to save time as well as disk space. A machine with a CPU that is in aggregate 10x faster than my laptop (I think that means most 64bit multi-core CPUs) running with a single S-ATA disk (that will have a sustained contiguous read speed of 80MB/s and write speed that is less) will save time when saving multiple Xen DomU’s if it runs them in parallel and compresses them.

Also gzip is not the fastest compression program. There may be other options that are better suited to the needs of Xen.

I have filed a Debian bug 435406 requesting that compression be supported.

2 comments to Xen Saves