Wednesday, October 29, 2008

VMWare Recording and Replay

Simply, it allows for making a recording of (almost) everything that happens to a VM between the time you hit Record and the time you hit Stop. This is not a movie recording, but more of an execution recording. You can play it back however many times you like. Most important thing is it records at the instruction level , so it keeping the complete memory and system state.
The process is said to be deterministic , because it keeps all the instruction that send from the guest operating system. Which include all the IO instructions (Network , CD and all kind of IO) , user clicks and any other type of asynchronous call as well.

What is this good for? Well, have you ever tried testing a program only to encounter a bug that you just can’t reproduce? Maybe there was some memory corruption that happened under some specific case that you just can’t seem to diagnose. Or maybe it’s a network packet that came in in some form that your application didn’t expect. Under normal circumstances, you’d have to do a lot of guesswork in order to find out what exactly happened. Far too often, it’s just too hard to reproduce the bug and it goes unfixed for some time.

Now imagine instead that you’re testing the program in Workstation and, before your testing, you hit Record. You attempt the test and the program crashes in some weird manner. No problem. Hit Stop and replay the recording. Just before the crash occurs, stop the playback and attach a debugger. Messed up? Didn’t find the cause? Replay that recording again.

In addition to the programming debugging this can be used as a fault tolerance and clustering technique. Where you can create an environment with same VM image and then you can pick one of them as the primary and other one as the backup . When the actual invocation happen rather then recording the events in the primary image , you can send them to the backup image. So if the primary fails , backup can easily take over. Because it is not just a replicate , it is an identical to the primary at anytime.

Finally I consider this as a very handy tool as well as can be used to many application to save the time. May be in the future when you report a bug you can attach the VM record log so that other people can easily reproduce the error.

1 comment:

Pengcheng said...

Thank you. Axis guru