VMware Cloud Community
sispeo
Contributor
Contributor
Jump to solution

Performance issue using virtualization

When comparing our software installed in a physical host and in a comparable VM (same CPU, memory), we notice that the product is two times slower when running in a VM (Guest OS is Windows 2003, using an ESXi 4.0 host. Software uses only one CPU)

As we are not in production environnement, we tried with all others VM powered off. We tested our VM with and without CPU reservation (best results with), with and without memory (quite no difference), and with 1, 2 and 4 vCPU

After several tests, it seems that the problem comes from usage of semaphores : when replacing them by critical sections (but we can't replace all), performances are quite the same between the physical host and the VM. All code is executed with similar performances but when using semaphores, the VM consumes CPU longer than the physical host.

Does anyone already eared something about such a problem ? Is there a reason to explain bad performances when using semaphores under Windows hosted by ESXi 4.0 ?

For example, we wrote a simple program to benchmark semaphores under Windows hosted by ESX (in our lab, it took 10sec on a physical host and 22sec in a VM) :

#include "stdafx.h"

int _tmain(int argc, _TCHAR* argv[])

{

unsigned __int64 nCount;

DWORD nTickCount = ::GetTickCount();

HANDLE hSemaphoreBridgets = CreateSemaphore(NULL, 1, 1, NULL);

for (nCount = 0; nCount < 10000000; ++nCount)

{

WaitForSingleObject(hSemaphoreBridgets, INFINITE);

ReleaseSemaphore(hSemaphoreBridgets, 1, NULL);

}

printf("Duration %d s\r\n", (::GetTickCount() - nTickCount) / 1000);

CloseHandle(hSemaphoreBridgets);

return 0;

}

0 Kudos
22 Replies
AlbertWT
Virtuoso
Virtuoso
Jump to solution

Great thread, so for Windows Server 2003 x64 R2 SP2 and above we can enable the MMU optimization according to the Processor type ? (anything not binary/software) ?

Kind Regards,

AWT

/* Please feel free to provide any comments or input you may have. */
0 Kudos
admin
Immortal
Immortal
Jump to solution

Great thread, so for Windows Server 2003 x64 R2 SP2 and above we can enable the MMU optimization according to the Processor type ? (anything not binary/software) ?

Yes, for both Intel and AMD hardware.

0 Kudos
AlbertWT
Virtuoso
Virtuoso
Jump to solution

Thank you Mr. Mattson Smiley Happy

Cheers.

Kind Regards,

AWT

/* Please feel free to provide any comments or input you may have. */
0 Kudos