Wednesday 5 January 2011

Hyper-V: Preparing A High Load VM For Time Skew

We have a previous post on setting up the Windows Time service here:

To date we have had decent success on reigning in a heavily loaded VM’s tendency to skew its time.

What we have come with via a number of sites listed below and a lot of reading in online forums follows.

  1. Hyper-V Integration Services: Time Synchronization remains enabled.
    • Yes, even on DCs.
  2. Registry edit to allow the VM to pick up its time from the Hyper-V host only while booting:
    • reg add HKLM\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\VMICTimeProvider /v Enabled /t reg_dword /d 0
    • Copy and paste the above into Notepad to make sure there are no line breaks as it is all in one line.
  3. Edit the Windows Time registry settings to make the time service poll more frequently:
    • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\W32Time\Config
      • "MaxAllowedPhaseOffset"=dword:00000001
    • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient
      • "SpecialPollInterval"=dword:000000XX
        • We start with an interval of 120 Seconds
        • image
  4. Set the appropriate time server source:
    • w32tm /config /syncfromflags:manual "/manualpeerlist:0.ca.pool.ntp.org,0x1 1.ca.pool.ntp.org,0x1 2.ca.pool.ntp.org,0x1 3.ca.pool.ntp.org,0x1" /reliable:yes
      • Note the quotes enclosing the time server names.
  5. w32tm /config /update
  6. net stop w32time && net start w32time
  7. w32tm /resync /force
  8. w32tm /query /source
    • image

Further Reading:

NOTE: This post may be updated at any time to reflect changes to the above methodology. Please keep in mind that this is a work in progress.

UPDATED 2012-03-06: Tweaked the registry settings as per comments below and the setting found in the MSDN article linked above.

Philip Elder
MPECS Inc.
Microsoft Small Business Specialists
Co-Author: SBS 2008 Blueprint Book

*Our original iMac was stolen (previous blog post). We now have a new MacBook Pro courtesy of Vlad Mazek, owner of OWN.

Windows Live Writer

10 comments:

Seanpt said...

For clarification -- is this all being run on the virtual SBS?

Philip Elder Cluster MVP said...

Sean,

These are the steps we would take with SBS, Win2K8 R2, or any other server based OS running in Hyper-V.

We have had a lot of problems with server VMs keeping their time when they are running a fairly high load such as SBS or SQL.

Philip

Seanpt said...

I've run into that as well. But for clarification are you making this registry changes on the virtual machine (the SBS2008 or 11 or whatever virtual instance) or are these registry settings for the host?

(I assumed on the virtual machine but you know what they say about assumptions...)

Philip Elder Cluster MVP said...

Sean,

The modifications indicated are on the guest (VM) OSs.

Philip

Richard Blanco Jr said...

Philip, another question for clarification...

Aside from running these processes on the VM to adjust time settings(in my case a VM of SBS2011), what are process are you recommending to run on the actual host server? The Hyper-V R2 host we setup is a standalone (not part of any domain) as is the recommended setup. Are you findings showing that the following should be run on the host server to have it use an external pool for proper time as well (from your linked article):

On SBS 2008 or the PDCe:

w32tm /config /manualpeerlist:pool.ntp.org /syncfromflags:manual /reliable:yes
w32tm /config /update
net stop w32time && net start w32time
w32tm /resync /rediscover

Thanks!! Keep up the great work that you do for the SBS community!!

Philip Elder Cluster MVP said...

Richard,

Set up the host to poll pool.ntp.org.

Then set up the PDCe to poll the host for time. Firewall exclusions may be required on the host.

Philip

Unknown said...

Very helpful. However, my VMs are running Windows 2000 (part of the reason for virtualizing - to work on moving to a newer platform). Can you give the appropriate modifications for Win2K? Many of the w32tm commands given don't exist or have an equivalent. And it appears I have to restart the VM to get the changes applied, is this correct? Thanks.

Philip Elder Cluster MVP said...

Sam,

Got me there. I am sorry, but other than test installing Win2K into Hyper-V and troubleshooting some issues with Win2K in Hyper-V on behalf of some others, I do not know off hand what the command set is.

Please see Microsoft KB 216734: How to configure an authoritative time server in Windows 2000 for the way to configure things for an External Time Source. It looks like a bunch of registry edits.

Philip

SortingThisOut said...

Thank you very much for this write-up but I believe there is an error in the way the setting of the SpecialPollInterval for NTP is entered.

In Step 3 it is referenced as being as under HKLM\CurrentControlSet\services\W32Time\Config. Microsoft documents this proper place for this as belonging under ..TimeProviders\NtpClient (HKLM\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient\SpecialPollInterval) in KB816042.

If SpecialPollInterval is configured as outlined in Step 3 it does not appear to be used when the configuration is dumped with w32tm /query /configuration.

I also find myself questioning SpecialInterval value. It could just be me but I’m not finding that listed as a value by Microsoft. Can you point me to where this is documented?

Ken Wallewein said...

Has anyone done a script of this, that includes the registry edits?

/kenw