Clock drifts on virtual machine, nothing helps

time-synchronizationubuntu-16.04virtual-machinesvmware-esxi

I have very rapid time drifts on vmware.

-241587 20:38
-241587 20:39
-241587 20:40
-241587 20:41
-241587 20:42
-0.014 20:02
-0.025 20:03
-0.056 20:04
-0.093 20:05
-0.093 20:06
-68996. 20:07
-68996. 20:08
12.923 20:07
12.923 20:08
20.371 20:09
21.734 20:10
21.734 20:11
-67965. 20:12
-67941. 20:13
-67915. 20:14
-67906. 20:15
-67906. 20:16
-67897. 20:17
2.508 20:16
2.508 20:17
37.491 20:18
40.774 20:19
40.774 20:20
40.774 20:21
-67927. 20:22
-67912. 20:23
-67912. 20:24
-67897. 20:25

NTP tries to deal with it but as you can see it's having troubles.
I also tried vmware-tools, but they clearly inferior to NTP.
My NTP configured with frequent sync interval and resistance to panic:

tinker panic 0
restrict 127.0.0.1
restrict default kod nomodify notrap
server 10.0.0.3 iburst minpoll 4 maxpoll 6

So, I realized it's better to find the cause of drifts.
I found that the time drift depends on CPU load. Higher CPU load – higher drifts.
CPU and memory steal don't affect drifts. I isolate single virtual machine on one host – drifts still continue.
I've tried different clock sources. hpet, tsc, acpi_pm. – still drifts continue.
I was disabling/enabling them on guest level in kernel settings, and on VMware level in vmkernel.boot settings. – nothing worked.

cat /proc/interrupts | grep timer; sleep 10; cat /proc/interrupts | grep timer
  0:         46          0          0          0          0          0          0          0   IO-APIC   2-edge      timer
LOC:     109263     298456     176209     142493     237279     126348     113116     104975   Local timer interrupts
  0:         46          0          0          0          0          0          0          0   IO-APIC   2-edge      timer
LOC:     109499     299498     176782     142786     237786     126769     113417     105206   Local timer interrupts

Guest OS: Ubuntu 16.04.1
VMware 5.5

Best Answer

You can enable periodic synchronization with the following .vmx configuration file option:

tools.syncTime = true

Set the period to something very low, like every 20 secs:

tools.syncTime.period = 20

For this to work you need to have VMWare tools installed in your guest OS.

See http://www.vmware.com/pdf/vmware_timekeeping.pdf for more information

Related Topic