What is a virtual machine
A virtual machine (VM) is a software application that allows you to have a simulated computer that executes programs like a physical machine. This lets you test applications in an controlled environment. You can configure the hardware that the virtual image thinks it has access to. The benefit is that you have a large file instead of having an actual computer. This allows you to easily back it up or to copy it to different physical computers. Some of the versions of virtual machine provide for versioning, cloning, and linking of virtual machine images, to make it easier to create and use. With a virtual machine, the computer the virtual machine application is running on is considered the host and the virtual machines are the guests. One of the criteria in selecting a virtual machine application for development is which Operating Systems are needed for testing and which Operating Systems are you running on the host system. The selection of the guest's Operating System is sometimes restricted, also some are restricted to run on certain host Operating System.
Some of the virtual machine application available allow the user of multiple virtual machines running on the same computer. This allows you to have multiple virtual machines running at the same time on your computer.
There are versions of virtual machine application that include their own Operating System, so they do not run on a host Operating System. This provides for less overhead which results in better performance. These are used in server consolidation since they are best for performance.
The main advantages of virtual machines are:
- Multiple Operating System environments can coexist on the same computer, in complete isolation from each other.
- You can test applications, maintenance, high availability, and disaster recovery
The main disadvantages of virtual machines are:
- The virtual machine is less efficient than a real computer as it accesses the hardware indirectly.
- When multiple virtual machines are concurrently running on the same physical host, each virtual machine may exhibit varying performance, which highly depends on the workload imposed on the system by other virtual machines.
- They share the memory and storage of the host and are therefore limited to how much they can utilize.
The reasons for using a virtual machine include:
- Develop and test multiple Domino and Notes versions on a single personal computer.
- Connect virtual machines to simulate and test multi-server configurations.
- Use multiple snapshots to facilitate testing.
- Archive test environments on file servers where they can be easily restored and shared.
- Less need to keep buying hardware or to clean machines.
- The virtual machine can be configure to "roll-back" all changes when shutdown.
- Test older Domino Server versions within virtual machines.
- Crash a server and not impact other developers or your personal computer.
- Test how applications perform with poor network connectivity.
- Testing Domino applications running on different Operating Systems.
- Testing a cluster's failover impact to your application.
- Test applications using different browser versions.
The following are some of the currently available virtual machine applications:
- VirtualBox is an open source virtual machine developed by Sun Microsystems (now owned by Oracle Corporation). Works extremely nice on Ubuntu workstations.
- VMware provides virtual machines for x86.
- Xen virtualization system is intended to run a moderate number of full-featured operating systems, Linux, Solaris, as well as Windows XP and 2003 Server (requires Version. 3.0 and an Intel VT-x(Vanderpool) or AMD-V (Pacifica)-capable CPU).
- KVM is a Linux kernel module maintained by Red Hat, that enables a modified QEMU program to use hardware virtualization.
- Virtual PC from Microsoft allows Windows 7 to run virtual Windows XP, Windows Vista, and Windows 7 as guests.
- Hyper-V from Microsoft runs on Server 2008 R2
- Parallels Workstation supported host Operating System are Mac, Windows, and Linux.
Virtualization best practices
When use virtual machine for Domino application, consider the following. Note that some of the recommendations might not be valid for every virtual machine application.
- Allocate fixed memory size and fixed disk size.
- If possible, run all the virtual machines RAM in real RAM, avoid swapping.
- Do not limit the RAM the virtual machine can effectively use .
- Lotus Domino calculates its cache size based on Operating System available memory. It is not aware of artificial limitations imposed by virtual machines.
In Memory -> Resources, the “Unlimited” really means “up to the amount allocated to the virtual machine”, therefore, is the correct setting.
- Do not share volumes.
- Pre-allocate disk space and install on a recently defragmented drive.
- Use virtual machine file store volumes instead of directly allocated physical volumes.
- Defragment drives - Defragment drives on both virtual machine and the host system of the virtual machine.
- Create virtual machines on a different partition to the host operating system or swap file. It makes sense to store virtual machine images on fast external USB, Firewire, or eSata drives.
- Turn off hardware devices that are not required in the virtual machine such as USB ports, Sound Devices, Floppy Disks, and CDs.
- Configure the virtual machine to start with the CD and DVD optical drive disconnected.
- Either set fixed one CPU or two to n CPUs.
- With low CPU demand configuring one fixed CPU should give best performance.
- Never allocate more CPUs then the host system has.
- The guest operating systems have different kernels for single or multiple and 32-bit or 64-bit CPUs.
- Use a host with a 64-bit CPU to test guest that will run on 64-bit operating systems.
- Enable hyper-threading on the host machine.
If using VMware then install virtual machine Tools.
Small machine example for Domino application server might have the following configuration:
- 32 bit
- 1 CPU
- Max 3 GB RAM (more is not effective on a 32 bit machine)
A disk snapshot is a copy of the virtual machine disk file recorded at a specific time. The snapshot preserves the original VM disk file by disabling writes to the original disk file. All the new writes are made to the snapshot version of the VM.Snapshots. Because the snapshot file is only a change log of the original virtual disk, it is not a backup and you should not rely upon it as a direct backup process. The virtual machine is running on the most current snapshot, not the original vmdk disk files.
- Every VMware snapshot creates a new delta file, while the older one becomes read-only file. Since changes to the VM are made directly to the delta file, the file size keeps increasing. Multiple snapshots of a VM should be taken only if the VM has frequent changes or in case of system level changes such as patches or driver updates.
- Allocate 30% more storage to each VMware snapshot.
- Use snapshots as a versioning tool rather than as the data backup.
- Set the snapshots retention period according to your organization's requirements and delete the out-of- date copies. A delete operation with the VMware snapshot tool commits all the changes stored in the delta file to the original VM. Therefore, plan the snapshot deletion time. Avoid bulk deletion unless the snapshots are creating storage overhead. Delete the delta files one at a time, with the oldest copy being deleted first. Bulk delete operations should be performed when I/O activity on the original VMs is at its lowest.
Clone a virtual machine to easily deploy identical copies of a fully configured virtual machine. You can do anything with a clone that you could with the original virtual machine. The clone may be linked or full:
- Full clone: This is an independent copy. A full clone shares nothing with the parent after the cloning operation.
- Linked clone: This is a copy of a virtual machine that shares virtual disks with the parent virtual machine in an ongoing manner. Conserves disk space.
The first and simplest reason for using virtual machine templates is efficiency. With templates, many repetitive installation and configuration tasks can be avoided. The result is a fully installed, ready to operate (virtual) server in less time than manual installation. Templates are also used to help enforcing consistency and standards. Deploying from templates helps to enforce corporate standards such as including anti-virus and management software in any machine connected to the network.
The use of templates is a best approach to set up a virtual machines because templates can help protecting a virtual machine image from any changes by the users. When the virtual machine is in template mode, it cannot be deleted or added to a team, and the virtual machine's snapshots cannot be deleted.
To protect the template, set the file to read only or remove write permission for the virtual machine’s files. This precaution prevents inadvertently deleting a virtual machine through the file system, or from disabling template mode for a virtual machine .
Windows guest performance tuning
Microsoft Windows offers certain simple yet highly productive tweaks that can be universally applied to any Windows virtual machine guest operating system installation. This section describes modification of certain registry entries. The Microsoft Windows registry editor is an advanced tool and should be used by advance user. Take appropriate backup of registry before you start making changes.
Disable the kernel paging of code to give a performance boost. It improves performance on machines with a lot of memory, because it prevents disk reads to get code or data, below are the registry entries to be edited:
- HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management
- Value name: DisablePagingExecutive
- Data Type : REG_DWORD
- Data : 0 or 1 (Default is 0)
Set to 1 to stop paging for “pagable” parts of kernel drivers. This can use more system memory but run faster.
This entry controls the maximum amount of RAM that can be locked for I/O operations. The default minimizes RAM usage. An I/O intensive system could benefit from larger buffer sizes.
Setting this parameter too high can result in slower performance. Set it in increments and see how it affects your system. A rule of thumb is to set to a value calculated by using the formula "Total RAM size in KBs divided by 8". Edit these registry entries to improve I/O performance:
- HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management
- Value name: IOPageLockLimit,
- Data: Set to a calculated decimal value of the total RAM size in kBytes divided by 8
Increase performance by disabling the last access update file's date.
The following changes is to set the operating system to disable last access update for directories and files on the Windows server, which translates into a radical reduction in the total I/O. Because the Domino processes access the data files frequently and have their own headers with time stamps within them, this saves I/O resources in updating time attributes for files or directories.
- Value name: NtfsDisableLastAccessUpdate.
- Data: Set it to 1 to stop updating the last access value.
Parent topic: 3.0 Infrastructure impact for application development