[ILUG] Timekeeping in virtual machines
Niall O Broin
niall at linux.ie
Thu Apr 3 11:08:43 IST 2008
Timekeeping in virtual machines has definite issues, whether the host
software be Xen or VMware (or presumably some of the others, though
my experience is mostly with Xen and VMware) and my specific question
now concerns VMware workstation, where I have a VM running SLES9. The
matter is discussed at http://www.vmware.com/pdf/vmware_timekeeping.pdf
and what I currently have is
tools.syncTime = TRUE
in the vmx file, and in the kernel options line
clock=pmtr
I've also tried
clock=pit nosmp noapic nolapic
in the kernel options line but it was no different from clock=pmtr.
NTP client software is NOT running in the VM and now time tracks the
host reasonably, but jerkily, like this:
while true; do here=`date +%s`; there=`ssh host "date +%s"`; echo -n
" $[$there - $here]";sleep 1; done
4 5 4 5 5 6 5 5 6 5 6 6 7 6 7 7 7 7 8 8 8 9 8 8 1 0 1 1 1 1 2 2 2 2 3
2 2 3 4 3 3 4 3 4 4 4 4 5 5 5 5 5 6 5 6 6 7 6 7 7 7 7 7 8 7 8
For my purposes now it's OK, but I can certainly see situations where
it would not be. For instance:
while true; do then=`date +%s`; sleep 5;now=`date +%s`; echo -n " $
[$now - $then]"; done
5 5 13 5 5 5 5 5 5 5 5 5 5 5 13 5 5 6 5 5 5 5 5 5 5 13 5 5 5 5 6 5 5
5 5 5 5 13 5 5 5 5 5 5 5 5 5 5 5 15 5 5 5 5 5 5 5 5 5 5 5 13 5 5 5 5
5 5 5 5 5 5 5 14 5 5 5 5 5 5 5 5 5 5 5 13 5 5 5 5 5 5 5 5 5 5 5 13 5
Sometimes after sleeping for 5 seconds, you see a wallclock advance
of much more. I can definitely imagine scenarios where this would be
bad.
I have also tried the suggestion in "Guest Clock Synchronization With
Non-VMware Software" in the referenced document, but after 20 minutes
up, the guest was two
minutes behind the host with ntpq -p showing
remote refid st t when poll reach delay
offset jitter
========================================================================
======
*tardis.local 84.16.251.78 3 u 13 64 377 0.061
122898. 584.872
To be honest, I expect that "time tracks the host reasonably, but
jerkily" is as good as I'm going to get but if anybody has any other
suggestions, I'm all ears - or eyes.
Niall
More information about the ILUG
mailing list