Summary: Is there a VM that's optimized for fast in-memory rollback to a previous state?
I've tried in vain on StackOverflow and SuperUser — maybe this is the right place to ask this question. :)
I'm looking for the fastest way to rollback a virtual machine to a previously known state. I'll be doing a lot of rollbacks to the same state. Taking a snapshot can be slow, but the rollback needs to be fast.
Ideally, I'd like the performance of the rollback to be as close to the performance of a single memcpy() as possible.
I'm currently testing things on my portable machine (Mac OS X), but will later deploy this to a beefy Linux server. Portability would be nice, but only running on Linux is fine. Commercial solutions are fine, if they get the job done.
For reference's sake, here's how long a memcpy() takes on my machine: (Code available here.)
Size Time ========= ========= 64 MB 0.030 s 128 MB 0.085 s 256 MB 0.140 s 512 MB 0.290 s 1024 MB 0.600 s
So far I've tried VirtualBox and VMWare Fusion on my machine. Performance was comparable for both.
Ideally, I'd also like to rollback the disk state. VirtualBox seems to have support for "immutable" disks, where all disk I/O is logged to a differential file and thrown away on rollbacks. That seems like a natural fit.
For VirtualBox rolling back a VM with 2.5 GB of assigned RAM with the state saved on disk (a SSD) took ~35 seconds.
Since disk I/O is expected to be slow, I next created a RAM disk (formatted as HFS+) and moved the snapshots there. The rollback of the otherwise unchanged VM to the same state then takes ~16.5 seconds.
The snapshot data takes up 1.11 GB. So VirtualBox takes ~15s / 1 GB of data when rolling back from a RAM disk. That's 6.72x the time of a memcpy(). (Does going through Mac OS X' I/O system cause that much overhead?)
Since I know of no way to rollback a VirtualBox VM without first shutting it down, and later starting it up again, it could be that some of this is caused by other factors.
Ideally, the hypervisor would keep all snapshot state in main memory, and use memcpy() for a rollback, letting us rollback in ~5 seconds. (An even smarter hypervisor might implement copy on write on pages and only rollback memory pages that actually changed.)
Are there any hypervisors which are optimized for rollback-frequently workloads? If not: What might be the most viable way of implementing such a thing myself?
(I've also done a bit of research into process-level rollback and there seems to be some interesting solutions for that for Linux; but having rollbacks work for arbitrary applications and being able to rollback I/O are big pluses.)
(What I really want to do is rollback to a checkpoint in arbitrary Java applications, ideally together with their I/O. I've only found dead research projects for rolling back a JVM, but maybe somebody is aware of more current work? It'd however need to do with pretty much arbitrary Java applications.)