[ntp:questions] three questions about ntpd, kvm-clock and clock speeds

Martin Burnicki martin.burnicki at meinberg.de
Fri Oct 31 08:38:41 UTC 2014


just some basics:

The reference implementation of NTP (ntpd) polls the reference time 
sources in cyclic intervals, filters the replies, and tries to 
disciplined the sysrtem clock such that the determined time offset *and* 
clock drift are minimized. However, this only works well if the 
*undisciplined* system time is increasing in a stable way.

In a VM the virtualized timer ticks may be stable (i.e. occur in 
constant intervals) , or not, depending on the type and version of the 
virtualization software.

For example, the VMware folks have spent quite some effort to get 
timekeeping inside their VMs working very good, so you can use ntpd 
inside the VM to get the system time synchronized pretty accurately.

In *earlier* versions of VMware this did *not* work very well, so the 
suggested solution at that time was to use VMware's built-in timekeeping 
mechanisms to keep the time inside the VMs synchronized.

If a built-in mechanism is used to synchronize the time inside a VM then 
the resulting accuracy depends on how this has been implemented by the 
maintainers of the virtualization software. In worst case the VM's 
system time is simply stepped in periodic intervals.

I've recently run a test under VMware with ntpd running under Linux 
inside a VM where the reference time source was a GPS PCI card installed 
in the physical machine was passed through to the VM. The loopstats 
showed that the time offset determined by ntpd was below +/- 5 
microseconds, which I found pretty good.

On the other hand, we had discussions here with a different 
virtualization software (not kvm) where you obviously had no chance to 
use ntpd successfully since the system time itself had much too much jitter.

Unfortunately I haven't tried kvm, yet, so I can't tell how good 
accurate timekeeping is supported by kvm.

Martin Burnicki

Meinberg Funkuhren
Bad Pyrmont

More information about the questions mailing list