Running Windows as a guest in VMware is way cool, since this breaks the evil bond Windows enters with your hardware, acting as if the GUI was the OS. A few things to observe when setting up a Windows 2003 Terminal Server with VMware Server.
With the release of VMware Server for free, it has become very simple to run virtual machines on a server. We use it to run Windows 2003 Terminal Servers on multi core boxes to provide Windows Applications to Linux Desktops and Thin Clients.
Observe the following rules when setting up your W2K3 VMware guest and you should be all set.
MemTrimRate = "0" sched.mem.pshare.enable = "FALSE" sched.mem.maxmemctl=0 MemAllowAutoScaleDown = "FALSE" mem.ShareScanTotal=0 mem.ShareScanVM=0 mem.ShareScanThreshold=4096These settings will stop vmware from trying to save memory on that virtual machine by moving it to disk and sharing it with other vmware instances. While this is very effective in reducing the memory footprint of your vmware guest, it can also cause it to be slow, especially when memory has to be pulled back up from disk. Obviously this will only work if you actually do have enough memory in your system. You can see if the settings work, if you look at the vmware-vmx process with top, and find that RES and SHR memory counters are in the vicinity of the VIRT counter.
mainMem.useNamedFile = "FALSE"It does help indeed, as the vmem file is gone. But running lsof on the vmware-vmx process holds an open file handle to a deleted file in /var/tmp (or /tmp). This file has taken the place of the vmem file and eventhough it is deleted recent linux kernels will insist on syncing its content back to disk. The sollution to this problem is to make vmware put its memory file into a tmpfs filesystem a good candidate it /dev/shm, as long as you make sure it is large enough. Edit /etc/fstab to limit the size of /dev/shm to a bit more than the ram allocated to your vmware images.
none /dev/shm tmpfs size=8g 0 0Remount the /dev/shm filesytem and edit /etc/vmware/config file to point to the tmpfs:
tmpDirectory = "/dev/shm"Now you can restart the vmware instances and use lsof to verify that they are now keeping their mmap files in tmpfs. Note that this trick does NOT use the memory twice.
There is ongoing discussion about the performance impacts of assigning two CPUs to a W2k3 guest. For now we leave it at 1 CPU.
We recently spent a lot of time optimizing a customers W2K3 instance (this is where all this info comes from) only to eventually figure out, that the bad performace, was due to Windows XPe ThinClients that were writing directly to their flash drives. Once the RAM-Disk-Redirection driver on these Boxes was enabled, performance improved considerably.
Windows XPe ThinClients normally work on an internal flash drive. Flash is fine for reading but quite slow for writing. On some ThinClients there is a program built in which lets you redirect all write operations to RAM. Since ThinClients are not suposed to store anything on the local flash anyway this is a good way to make flash fast.