Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: best practices for Linux guests  (Read 3287 times)

0 Members and 1 Guest are viewing this topic.

sajugovind

  • Guest
best practices for Linux guests
« on: December 11, 2013, 04:14:39 pm »
Recommended Configurations:

These configurations are expected to have the best timekeeping behavior:

    RHEL 6 32-bit or 64-bit running on ESX 4.0 or later
    RHEL 5.4 or later 32-bit or 64-bit running on ESX 3.5 or later
    SLES 10 SP2 or later 64-bit running on ESX 3.5 or later
    SLES 10 SP2 or later 32-bit running on ESX 3.5 or ESX 4.x
    SLES 11 32-bit or 64-bit running on ESX 4.0 or later
    Ubuntu 8.04 32-bit running on ESX 3.5 or later
    Ubuntu 8.04 or later 64-bit running on ESX 4.0 or later
    Ubuntu 8.04 or later 32-bit running on ESX 3.5 or ESX 4.x

Among different versions of RHEL 5 and RHEL 4, RHEL 5.4 or later has the best timekeeping behavior. For older versions, those supporting divider=10 have better timekeeping behavior than those that do not.

VMI is supported in ESX 3.5 and ESX 4.x. Support for VMI is not present in ESX 5.0. For more information related to VMI enabled kernels, see:

    Enabling Virtual Machine Interface (VMI) in a Linux kernel and in ESX 3.5 (1003644)
    Enabling VMI with SLES10 SP2 32bit virtual machines on ESX (1005701)

If you are running Java inside a virtual machine, some of the above parameters may affect the performance of your virtual machine. For more information, see:

    Best practices for running Java in a virtual machine (1008480)
    Time runs too fast in a Windows virtual machine when the Multimedia Timer interface is used (1005953)

Editing Kernel Configuration

Kernel command line parameters are specified in the /etc/lilo.conf or /boot/grub/grub.conf file, depending on your choice of boot loader.

For LILO, put the kernel command line parameters at the end of the append line. For example, if the append line looks like:

append="resume=/dev/hda6 splash=silent"

and you want to add clock=pmtmr divider=10 , the updated text is:
append="resume=/dev/hda6 splash=silent clock=pmtmr divider=10"

Remember to run /sbin/lilo after editing lilo.conf, so that your edits take effect.

For GRUB, put the kernel command line parameters at the end of the kernel line. For example if the kernel line looks like:
 
kernel /vmlinuz-2.6.18 ro root=/dev/hda2

and you want to add clock=pmtmr divider=10, the updated text is:
 
kernel /vmlinuz-2.6.18 ro root=/dev/hda2 clock=pmtmr divider=10

For additional information about working with boot loaders, see your Linux distribution's documentation.

NTP Recommendations
Note : VMware recommends you to use NTP instead of VMware Tools periodic time synchronization. NTP is an industry standard and ensures accurate timekeeping in your guest. You may have to open the firewall (UDP 123) to allow NTP traffic.

This is a sample /etc/ntp.conf :

Note: For Arch Linux example will read as below but also in /etc/adjtime

tinker panic 0
restrict 127.0.0.1
restrict default kod nomodify notrap
server 0.vmware.pool.ntp.org
server 1.vmware.pool.ntp.org
server 2.vmware.pool.ntp.org
driftfile /var/lib/ntp/drift

This is a sample (RedHat specific) /etc/ntp/step-tickers:

0.vmware.pool.ntp.org
1.vmware.pool.ntp.org
 
The configuration directive tinker panic 0 instructs NTP not to give up if it sees a large jump in time. This is important for coping with large time drifts and also resuming virtual machines from their suspended state.

Note: The directive tinker panic 0 must be at the top of the ntp.conf file.

It is also important not to use the local clock as a time source, often referred to as the Undisciplined Local Clock. NTP has a tendency to fall back to this in preference to the remote servers when there is a large amount of time drift.
 
An example of such a configuration is:
 
server 127.127.1.0
fudge 127.127.1.0 stratum 10
 
Comment out both lines.
 
After making changes to NTP configuration, the NTP daemon must be restarted. Refer to your operating system vendor’s documentation.
 

VMware Tools time synchronization configuration
When using NTP in the guest, disable VMware Tools periodic time synchronization.
 
To disable VMware Tools periodic time sync, perform one of these options:

    Set tools.syncTime = "FALSE" in the configuration file ( .vmx file) of the virtual machine.

    Or

    Deselect Time synchronization between the virtual machine and the host operating system in the VMware Tools toolbox GUI of the guest operating system.

    Or

    Run the vmware-guestd --cmd "vmx.set_option synctime 1 0" command in the guest operating system. To enable time syncing again, use the same command with " 0 1 " instead of  " 1 0 ".

For ESX 4.1 and later, use these parameters for Linux, Solaris, and FreeBSD:

    To display the current status of the service:

    vmware-toolbox-cmd timesync status

    To disable periodic time synchronization:

    vmware-toolbox-cmd timesync disable

These options do not disable one-time synchronizations done by VMware Tools for events such as tools startup, taking a snapshot, resuming from a snapshot, resuming from suspend, or VMotion. These events synchronize time in the guest operating system with time in the host operating system, so it is important to make sure that the host operating system's time is correct.

To do this for VMware ACE, VMware Fusion, VMware GSX Server, VMware Player, VMware Server, and VMware Workstation, run time synchronization software such as NTP or w32time in the host. For VMware ESX run NTP in the service console. For VMware ESXi, run NTP in the VMkernel.


Note: VMware Tools one-time synchronization events should not disabled.

Virtual Hardware clock configuration
When configuring the Linux guest operating system, if you are given a choice between keeping the “hardware” clock (that is, the virtual CMOS time of day clock) in UTC or local time, choose UTC. This avoids any confusion when your local time changes between standard and daylight saving time (in England, "summer time").

For additional information, see Timekeeping in VMware Virtual Machines .
 

Note for uses on divider=10
For some operating systems, divider=10 is a supported kernel configuration option, but might not be necessary for accurate timekeeping. Using it reduces the frequency of timer interrupts by 10x, which reduces the CPU overhead of processing timer interrupts. This overhead is especially noticeable for idle virtual machines. The only drawback of using divider=10 is that the granularity of wake-ups provided by the kernel changes from 1 ms to 10 ms. The vast majority of applications are not affected by this, but using divider=10 may not be the right tradeoff for some time sensitive applications.

For some operating systems, specifically older versions, divider=10 greatly improves timekeeping accuracy and is strongly recommended.