Friday, March 05, 2010

Virtual CPUs and performance of virtual machine

Performance comparison of multi threaded application in relevance to multiple virtual CPUs in virtual machine



I was tasked (actually wanted to know myself) if common understanding going around that adding virtual CPUs to virtual machine does not affect performance of such. Idea behind this thought is that since CPU is virtual then hypervisor will be spreading load across physical CPUs anyway and hence additional CPUs will not increase performance of your application.
I wanted specifically to test multi threaded application since this is what majority of web servers are.
So to test raw CPU performance I acquired 4 CPU IBM box. I wanted to make a test against VM guest running inside ESX 3.5 with different number of virtual CPUs and 1 another test - against physical hardware (no hypervisor).
For test itself I wanted something which is very CPU intensive and has no IO dependencies. I figured calculating PI to certain digit will be a good choice in this case.
Entire Visual Studio 2008 solution can be downloaded below. It consists of web service which accepts only 1 parameter which is "Number of Digits of PI to be calculated to" and returns back total time taken to calculate that number.
Solution also contains sample webpage which will call web service, that page was called by 10 virtual clients simultaneously. Total number of pages served were calculated and presented in table and graph below.

Conclusion: Adding more virtual CPUs for multithreaded application does it in fact increase performance of application.

Number of logical CPUs

Number of requests served

1 CPU

24

2 CPU

47

4 CPU

65

Physical box with 4 CPUs

70





Attachment:Download


Post a Comment