Time Drift in VM

Recently, we worked on an issue with time drift in a VM, and my colleague Johann Binder had an interesting finding I‘d like to share with you: 

The issue was with a VM that had SQL Server 2008 installed. In the eventlog of the machine we found Informational Events 1, Microsoft-Windows-Kernel-General, “The system time has changed to  ‎2011‎-‎11‎-‎04T11:21:47.725000000Z from ‎2011‎-‎11‎-‎04T11:21:41.976407900Z” several times every minute!

 

So this is telling us that the system clock is permanently adjusted as it does not keep up.  We turned of Time Synchronization for this VM from the Host, and the VM time lost a couple of seconds every minutes.

 

Looking into Task Managers Perfomance Graph of the VM, all CPUs had spikes in their utilization, although the VM and SQL Sever where supposed to be idle.

 

Now, this symptoms where known to us with a timer in SQL Server, and the workaround is to start SQL Server with the flag T8038

As it turned out, that did not help, as we had the same symptoms with SQL Server stopped, but SQL Reporting Services running.

Our suspicion was that the CPUs where send to sleep to often. We therefore disabled  deep C-States on the Hyper-V Host, and after a reboot of the host, the problem was gone.

 

reg add HKLM\System\CurrentControlSet\Control\Processor /v Capabilities /t REG_DWORD /d 0x0007e066

 

Note:

The computer idle power consumption will increase significantly if the deeper ACPI C-states (processor idle sleep states) are disabled. You may also check if the problem is resolved with a BIOS update.

 

Maybe this workaround can help in other time drift issues.. Let me know.

 

Cheers

Robert