Using the esxtop tool to identify VMware ESX memory use

12 August, 2009

Checking memory with the VMware Infrastructure Client
As an example, I have taken screenshots from a host with 64 GB of physical RAM with 29 VMs running on it. In the first screenshot, we go to the VMware Infrastructure Client (VI Client), select the host and watch the summary tab. In the right-hand corner, we see the “Resources” section. The image below shows that memory usage is at 41.06 GB out of 64 GB.


Click to enlarge.

From this image, we can see that 41.06 GB of memory is in use out of an available 64. But wouldn’t you also like to know which processes or VMs are using the 41.06 GB? To find out, we’ll use PuTTY as our SSH client to run VMware’s esxtop tool.

Let’s start a PuTTY session. Log on, start esxtop and press M for memory. The top of the screen features an impressive amount of info on your host’s memory usage.

Let’s take it from the top.

Physical memory

Click to enlarge.

The MEM overcommit avg tells us that the average memory overcommitment over the past one is between five and 15 minutes. A value of 0.20 is a 20% overcommitment of memory. In the second line, we see the PMEM stats that describe physical memory in the host. This host has 65,534 MB (or 63.99 GB), of which 800 MB is allocated to the cos (i.e., the service console); 672 MB is being used by the VMkernel and 4,0437 MB (or 39.489 GB) is used by “other,” which leaves 23,624 MB of free memory.

Note: The memory used by “other” is officially described as: “everything other than the ESX Service Console and ESX VMkernel.” It is not necessarily all memory consumed by the VM. Each VM, for example, also has memory overhead. The amount of overhead memory depends on the type of guest OS,the number of virtual CPUs, configured amount of guest memory and on whether the guest is 32-bit or 64-bit. For example, a dual-CPU virtual machine with 2,048 MB memory will have 126 MB overhead as 32-bit system and 163 MB overhead as a 64-bit system.

Service console memory

Click to enlarge.

The next line about VMKMEM is of less importance, though it does tell you how the VMkernel performs. But unless you’re troubleshooting an unusual problem, you won’t work with these values. Of more value is how the service console (cos) is doing, which is detailed on the next line. The first value (in this case, free) is the amount of idle memory in your cos. In our example, the cos has 92 MB RAM free out of the 800 MB allocated. Next, we see the swap space configured and swap space free, which are both 1,600 MB. Usually, I configure a host with a 1,600 MB swap partition and 800 MB cos memory.

While 800 MB may seem like a lot, third-party agents often run in the console and so the default 272 MB of memory is not enough. In that event, you want to increase cos memory and set it to 800 MB. You could set it for a higher number, but you might run out of partition space. I therefore always set the swap partition to 1,600 MB since you can also assign only a maximum of 1,600 MB to the cos. Since implementing that as a best practice, I haven’t had to resize a swap partition once.

Transparent Page Sharing (TPS)

Click to enlarge.

Back to our example, the Non-Uniform Memory Access, or NUMA, values in MB. As with VMkernel you seldom have to worry about these. It only shows you how ESX is distributing the memory across the NUMA nodes (if you have NUMA, that is) but these are not values you will be working with. Pay more attention to the PSHARE line. This one tells us how much memory is saved by transparent page sharing (TPS), which in some environments can be quite a lot. In our example, 32,492MB is shared between the VMs, of which 3,779 MB is common, which leaves us with savings of 28,713 MB (or 28 GB) of memory.

Let me explain this in a different way. On this host machine, a total of 32,492 MB is somehow the same in a lot of guests. By using transparent page sharing, ESX only needs 3,779 MB to “store” 32,492 MB. So we are saving 28,713 MB of memory. In my opinion, that is a large amount of memory to save on a single host. Just imagine how much this could save you across an entire virtual environment.

What is transparent page sharing?
VMware ESX can save lot of physical memory using transparent page sharing, especially in environments where a lot of similar OSes are in use. The hypervisor checks each block of memory that a virtual machine wants to write to physical memory. If that block of memory is equal to a block of memory already saved in physical memory, there is no need to use extra physical memory. Instead, ESX only sets a pointer and remembers that this block is used by other VMs. As longs as the VMs only read this block and never change it, the block is saved just once. ESX will use this block until a VM wants to make changes to the VM (write to the block). When that happens, ESX will create an additional copy.

When looking at Windows Server 2003, for example, one can see that a basic Windows install without any extra applications will easily occupy 250 MB RAM after startup. Now suppose I run 20 Windows VMs on one hypervisor. 20 instances of Windows requiring 250 MB RAM each would cost a total of 5,000 MB physical RAM without TPS. With TPS, however, 250 MB would have been stored and used only once. In other words, a memory savings of 5,750 MB. That’s not something to take lightly.


Click to enlarge.

Swap memory and ballooning

Click to enlarge.

This may sound strange, but I believe both SWAMp and MEMCTL numbers should be 0. Let me explain what they are:

  • The SWAP value displays the ESX server swap usages statistics, where “cur” is the current swap usage, “target” is how much ESX expects to swap and “r/s” and “w/s” show the rate at which the swapping occurrs.
  • MEMCTL shows the total amount (cur) of physical memory reclaimed using the vmmemctl module or the balloondriver, the total amount ESX attempts to reclaim (target) and the maximum amount ESX can reclaim (max).

Now, why should they be zero? Simply put, because they are both indications that ESX doesn’t have enough memory to give to the guests. The first thing ESX wants to do when resources are getting scarce is reclaim the least valuable memory from the guest OS. Because ESX can not talk directly to the OS, it uses the VMware Tools memctl-driver for this.

Ballooning
When VMware ESX runs out of guest VM space, ESX starts a process inside the guest which claims memory. The guest OS will then check the list to see if it has memory that is not in use. If there is, it will will give this to the process. Next, VMware Tools will claim this memory and tell ESX exactly which memory blocks ESX can reuse for other VMs. In this way, the last pieces of unused memory are squeezed out of the other guests to give it to the guests that need it more.

Swap to disk
If the ballooning technique isn’t sufficient, ESX will use its last resort: swapping out guest memory to disk. As disks are always much slower than physical memory, the guest VM will notice a performance degradation so that is not the way we want to go.

Therefore, as soon as you see the SWAP curr or MEMCTRL curr rise above zero, you should really start investigating what is wrong. As a rule of thumb, you should never load your ESX memory to more than 80% or 85%. This way you always have spare memory in case VMs start to use more physcial memory. Also, loading your ESX hosts in a cluster at more than 80% to 85% can get you into trouble with your VMware High Availability failover level.


virtual machine with input specifications already exists

10 August, 2009

While in the progress of deploying new virtual machines the deployment of a virtual machine stopped in one particular pool. After doing some investigation the viewcomposer log gives me the following message:

Violation of UNIQUE KEY constraint ‘IX_SVI_SIM_CLONE_GUEST_NAME’. Cannot insert duplicate key in object ‘dbo.SVI_SIM_CLONE’

I created a support call with VMware, the responses I got where remove those particular record from the database. Removing those records didn’t solved the problem, cause those records were written in different tables, so we created a query which does the trick for us.

Doing a search first, so we know which records will be deleted:

# Finding VM from VM_NAME and BASE_DISK key

SELECT * FROM SVI_SC_BASE_DISK_KEYS

where PARENT_ID = (SELECT ID FROM  SVI_SIM_CLONE

WHERE  (VM_NAME = ‘<VM-NAME>’))

SELECT * FROM SVI_SIM_CLONE

WHERE (VM_NAME = ‘<VM-NAME>’)

When I know which records will be removed I used the following query to actually remove the records:

# delete VM from VM_NAME and BASE_DISK key

delete from SVI_SC_BASE_DISK_KEYS

where PARENT_ID = (SELECT ID FROM  SVI_SIM_CLONE

WHERE  (VM_NAME = ‘<VM-NAME>’))

delete FROM SVI_SIM_CLONE

WHERE (VM_NAME = ‘<VM-NAME>’)

After actually removing the faulty records i was able to deploy new virtual machines again.


VMware View Client as a shell for XPe and XP Pro clients

26 June, 2009

Using the Win32 View Client on XPe or XP Pro will allow you to use the full featured View client with all the bells and whistles.  The problem is that it’s still XP and can be confusing to your users to have them log into one desktop just to send them to another virtual desktop. So how can we fix that? If you replace the shell with the View client you can eliminate the XP desktop and on a boot of the client the only interface presented to a user is the View Client. This makes logging in simple and clean. The problem with just replacing the shell with the View client is that once the user exits, logs out, or just accidentally closes the client, It  will not start again automatically. Below is a way to have the Client restart automatically and hide the needed command window.


The following instructions will hide the XP  desktop and present the user with just the View client and will restart if it gets closed. This was done on an HP t5730 Thin client but the process should be the same for most XPe Thin clients and even a repurposed XP Pro desktop.


Create a View.cmd file with the following.


@echo off

:View

“C:\Program Files\VMware\VMware View\Client\bin\wswc.exe”

goto View


Place it where ever you like,  c:\BatchFiles for example


Create a vbs script with the following in it. Place it wherever you like C:\BatchFiles for example.


Set WshShell = CreateObject(“WScript.Shell”)

WshShell.Run chr(34) & “C:\BatchFiles\view.cmd” & Chr(34), 0

Set WshShell = Nothing


Open Regedit and go to ;


HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon


Change Shell from explorer.exe to the new shell path and the Windows Scripting  command,  e.g  wscript c:\BatchFiles\view.vbs


Commit the changes to the flash drive if using XPe.


ewfmgr  c: -commit


Reboot. Enjoy the new View only interface!

Once this is done there will be no desktop for any users, including Administrator. You can still get to the Task Manager with a CTRL-ALT-DEL but the interface is gone. You can modify the Registry setting to use a specific user by logging in as that user and modifying HKEY_CURRENT_USER instead.


Distributed Power Management on x3850

5 June, 2009

While working at a customer site I have been working on setting up Distributed Power Management, DPM is an experimental feature delivered through VMware ESX 3.5 and vCenter 2.5. While having some problems with the configuration I had two goals. I wanted to keep redundancies within the current configuration and wanted to comply to the goals of the customer, which was as Green as possible.

To get the redundancy I created a single vSwitch with two portgroups one for the Service Console and one the VMotion port, with each a difference VLANs configured. At both portgroup an active physical NIC was attached which was standby on the other portgroup. My first goals was reached.

To get the second goal I selected the first internal NIC at the ESX host and configured this one attached to the VMotion portgroup. Within the portgroups I configured the auto negotiation as on the Cisco switch to. The reason for this is that is that the used NIC only support wake-on-LAN at 10 or 100 Mbit and not at 1 Gbit.

More info can be found at the following URL: http://tinyurl.com/r8bwth


Silent install without reboot

24 April, 2009

The View client can be installed in two ways. You can do a normal GUI based install what means that you click through the installation wizard or you can do a scripted or silent installation. The silent or scripted View Client installation can be personalized with loads of MSI parameters. Some of them are standard MSI, some of them are specific.

If you need to know the parameters just start a View Client installation and search for the files vmmsi.log and vminst.log. In these installation logfiles you can also find the MSI parameters used during the installation. If you want to suppress the system reboot after the View Client silent installation you could try to use the MSI parameter /norestart but it will not work. To suppress the reboot with the View Client you need to the the option: RebootYesNo.

(Screenhost from the vmmsi.log file)

To suppress the reboot after the View Client installation start the silent installation of the View Client like shown below:

VMware-viewclient-{3.x.x-xxxxxx}.exe /s /v /qn RebootYesNo=”No”


Which View Composer version is installed on my system?

21 April, 2009

As with all other Windows based applications you can find the version of the installed View Composer within  the Add/Remove Software dialog in the control panel. Just click on: Click here for support information.


VMworld 2008 – The day before

15 September, 2008

After picking up my badge en general stuff this day i found some nice info from Cisco, they were announcing the introduction of Cisco’s Virtual Switch for VMware ESX. During these days Cisco will introduce technologies and services to help the turn in the IT environment into a dynamic data center that is more scalable, more agile, and more resilient. More info will come when available.

They are still working hard to get everything done for Tuesday when vmworld will really start, tomorrow the Partner Day and the Technology Exchange is on the program.


VMware ESX and ESXi Comparison

5 September, 2008

Capability

VMware ESX

VMware ESXi

Service Console

Service Console is a standard Linux environment through which a user has privileged access to the VMware ESX kernel. This Linux-based privileged access allows you to highly customizing your environment by installing agents and drivers and executing scripts and other Linux-environment code.

VMware ESXi is designed to make the server a computing appliance. Accordingly, VMware ESXi behaves more like firmware than traditional software. To provide hardware-like security and reliability, VMware ESXi does not support a privileged access environment like the Service Console of VMware ESX. To enable interaction with agents, VMware has provisioned CIM Providers through which monitoring and management tasks – traditionally done through Service Console agents – can be performed. VMware has provisioned RCLI to allow the execution of scripts.

Remote CLI

VMware ESX Service Console has a host CLI command through which VMware ESX can be configured. ESX 3.5 Update 2 supports RCLI.

VMware ESX Service Console CLI has been ported to a Remote CLI (RCLI) for VMware ESXi. RCLI is a virtual appliance that interacts with VMware ESXi hosts to enable host configuration through scripts or specific commands.

Note: RCLI is limited to read-only access for the free version of VMware ESXi. To enable full functionality of RCLI on a VMware ESXi host, the host must be licensed with VI Foundation, VI Standard, or VI Enterprise.

The following Service Console CLI commands have not been implemented in RCLI:

  • ESXcfg-info
  • ESXcfg-resgrp
  • ESXcfg-swiscsi

Scriptable Installation

VMware ESX supports scriptable installations through utilities like KickStart.

VMware ESXi Installable does not support scriptable installations in the manner ESX does, at this time. VMware ESXi does provide support for post installation configuration script using RCLI-based configuration scripts.

Serial Cable Connectivity

VMware ESX supports interaction through direct-attached serial cable to the VMware ESX host.

VMware ESXi does not support interaction through direct-attached serial cable to the VMware ESXi host at this time.

SNMP

VMware ESX supports SNMP.

VMware ESXi supports SNMP when licensed to a VI Foundation, VI Standard, or VI Enterprise edition. The free version of VMware ESXi does not support SNMP.

Active Directory Integration

VMware ESX supports Active Directory integration through third-party agents installed on the Service Console.

VMware ESXi with a Virtual Infrastructure license and in conjunction with VirtualCenter allows users to be authenticated via Active Directory. In this configuration, users can log in directly to an ESXi host and authenticate using a local username and password.
The free version of VMware ESXi does not support Active Directory integration at this time.

HW Instrumentation

Service Console agents provide a range of HW instrumentation on VMware ESX.

VMware ESXi provides HW instrumentation through CIM Providers. Standards-based CIM Providers are distributed with all versions of VMware ESXi. VMware partners may inject their own proprietary CIM Providers in customized versions of VMware ESXi. To obtain a customized version of VMware ESXi, you typically have to purchase a server with embedded VMware ESXi through a server vendor.
At this time, HP also offers its customized VMware ESXi Installable on www.vmware.com. Dell and IBM will soon offer their customized version of VMware ESXi on www.vmware.com.
Remote console applications like Dell DRAC, HP iLO, and IBM RSA are supported with ESXi.

Note: COS agents have a longer lineage than CIM Providers and are therefore more mature. VMware is actively working with its 250+ partners to close the CIM Provider–Service Console agent gap.

Software Patches and Updates

VMware ESX software patches and upgrades behave like traditional Linux based patches and upgrades. The installation of a software patch or upgrade may require multiple system boots as the patch or upgrade may have dependencies on previous patches or upgrades.

VMware ESXi patches and updates behave like firmware patches and updates. Any given patch or update is all-inclusive of previous patches and updates. That is, installing patch version “n” includes all updates included in patch versions n-1, n-2, and so forth.

VI Web Access

VMware ESX supports managing your virtual machines through VI Web Access. You can use the VI Web Access to connect directly to the ESX host or to the VMware Infrastructure Client.

VMware ESXi does not support web access at this time.

Licensing

VMware ESX hosts can be licensed as part of a VMware Infrastructure 3 Foundation, Standard, or Enterprise suite.

VMware ESXi hosts can be individually licensed (for free) or licensed as part of a VMware Infrastructure 3 Foundation, Standard, or Enterprise suite.

Individually licensed ESXi hosts offer a subset of management capabilities (see SNMP and Remote CLI).

ESXi

(ESX not available without VI)

VI Foundation

(with ESX or ESXi)

VI Standard

(with ESX or ESXi)

VI Enterprise

(with ESX or ESXi)

Core hypervisor functionality

Yes

Yes

Yes

Yes

Virtual SMP

Yes

Yes

Yes

Yes

VMFS

Yes

Yes

Yes

Yes

VirtualCenter Agent

Yes

Yes

Yes

Update Manager

Yes

Yes

Yes

Consolidated Backup

Yes

Yes

Yes

High Availability

Yes

Yes

VMotion

Yes

Storage VMotion

Yes

DRS

Yes

DPM


VMware unveils VMDirectPath technology, Intel to support it with Nehalem

28 August, 2008

At the Intel Developer Forum (IDF) 2008, Intel showed on stage its upcoming new quad-core CPU codename Nehalem, much expected by the virtualization professionals because of the included Extended Page Tables (EPT) technology.

On top of that now there’s another reason to wait for Nehalem: the processor will support a new technology developed by VMware and called VMDirectPath.

VMDirectPath will allow ESX to avoid the emulation of network interface cards and map the physical NICs directly to the virtual machines:

Intel delivered a very interesting presentation about its effort to boost the hypervisor performance with VT-x, VT-d and VT-c technologies and slides from 27 to 32 are about VMDirectPath:

Nehalem CPUs for server use will be released no earlier than H2 2009.

VMware predicted that around that date the technology would completely cancel the performance degrade that virtualization introduces. It seems that to go there customers will have to bring with them a lot of hardware (and possibly drop a lot of flexibility).


VMware ESX and Enhanced VMotion Compatibility

27 August, 2008

The classic VMotion problem of recent times is the customer who buys tin from a vendor, only to find out that the processor number e.g. 53xx and 54xx, is actually quite significant. The principle difference which will prevent VMotion is the addition of SSE4.1 to the 54xx range of Intel processors (if you previously only had 53xx Intel processors).

An application using the SSE4.1 feature (or is aware of this feature) when VMotioned to a non-SSE4.1 host would likely blue screen trying to make use of this feature on the older host.

People then recalled the CPU mask feature in VMware – we’ll just mask it out they thought. Unfortunately VMware declared this was an unsupported mask with KB1993 and KB1991.

Note that for production environments, VMware neither supports nor recommends modifying VMotion masks for SSE3, SSE3, or SSE4.1 because of the risk of failure of the application or guest operating system after migration.

The reason soon became clear:

  • SSE features can be used by user-level code (applications).
  • Mask does not work for user-level code (i.e. applications).
  • In user-level code, CPUID is executed directly on hardware and is not intercepted by VMware.
  • Thus, VM cannot reliably hide SSE from an application

The best that customers could do was buy compatible hardware, and keep themselves right with vendor compatibility charts such as these ones from Dell and HP.

ESX 3.5 U2 brought a new feature: Enhanced VMotion Compatibility (EVC for short) which I’ll explain…

New CPUs are coming out with a facility to ‘turn off’ (mask) features that would make them VMotion incompatible with other hosts running older (compatible) CPUs.

For Intel this is called Flex Migration. It is clear that for processors that are in different families but support Flex Migration will negotiate the common feature set amongst the CPUs.

Where it is not absolutely clear, is where you have an existing cluster and you want to add in hosts with the new Flex Migration facility. You should be able to do this if you satisfy the following requirements (paste from Basic Administration Guide):

All hosts in the cluster must either have hardware live migration support(Intel FlexMigration or AMD‐V Extended Migration) or have the CPU whose baseline feature set you intend to enable for the cluster. For specific host processors supported, see Table 15‐1.

Table 15-1. Processors Supported in EVC Clusters

Vendor Baseline Processor Processors Supported
Intel Intel Core 2 (Merom) Intel Core 2 (Merom)
45nm Core 2 (Penryn)
AMD AMD Second Generation Opteron (Rev‐E/F) AMD Second Generation Opteron (Rev‐E/F)
AMD Third Generation Opteron (Barcelona)

It is therefore advised that customers buying new tin, if they cannot acquire a processor that is exactly the same or in the same family – purchase a Flex Migration enabled CPU.

It should also be clear that only masks the features on the processors, it does not turn them off. Programs which are written to guidelines will behave, those which are coded badly will see these features regardless – and more importantly will encounter issues if VMotioned to a host that used that feature. Pasted from VMware:

EVC utilizes hardware support to modify the semantics of the CPUID instruction only. It does not disable the feature itself. For example, if an attempt to disable SSE4.1 is made by applying the appropriate masks to a CPU that has these features, this feature bit indicates SSE4.1 is not available to the guest or the application, but the feature and the SSE4.1 instructions themselves (such as PTESE and PMULLD) are still available for use. This implies applications that do not use the CPUID instruction to determine the list of supported features, but use try‐catch undefined instructions (#UD) instead, can still detect the existence of this feature.

Therefore, for EVC to be useful, application developers must adhere to recommended guidelines on feature detection. CPU vendors recommend that software programmers query CPUID prior to using special instructions and features available on their CPUs. If this guideline is followed by programmers, EVC is a reliable mechanism for live migration of x86 virtual machines across varied hardware. Thus, you can use EVC to enable an entire cluster to use the same set of basic features, allowing migration with VMotion across any two nodes in the cluster. VirtualCenter can also set up new hardware add‐ons to the cluster and apply these masks.

Intel provide a comparison tool to check beforehand if a CPU possesses Flex Migration capability.

Further Information on this subject can be located in the VMware VMotion Guide and the ESX 3.5U2 Basic Admin Guide Page 238 Onwards.

Bron: http://www.novosco.com/articles/2008/08/19/vmware-esx-and-enhanced-vmotion-compatibility/