Troubleshooting poor performances of virtual machines in an Oracle VirtualBox

Sometimes I have to give a presentation on IT. I like to make a such presentation to be dynamic, combining together slides and a live demonstration. I often use several VMs in the same time to simulate scenario.

Preparing one such presentation, I made a few mistakes in the configuration of the VMs. Eventually, one VM was too slow during startup. An audience on the presentation didn’t noticed the problem, as I covered it up with an another part of the demonstration.

After the presentation, I analyzed the whole situation and found the weak point – the wrong choice between VM’s parameters.

Be careful with the VM parameters

We can make the wrong choices whenever we have too many options that we can change. The least problem is if we assign less memory the VM. It will be slower and we can improve this performance problem easily. Much bigger problem is if we are assigned too little of the processor time to the VM or when we choose inappropriate disk type.

The best practice is to keep the default parameters. Change them only if you are sure with the results of such action. Consider, when building the lab, to only allocate the minimal resources for every VM. That will spare resources inside the host machine and allow us to run more VMs at the same time.

01 - virtuelna laboratorija

As you can see from this picture above, I built a large lab and need to provide enough resources for all those machines to work in the same time. I achieved that goal with two approaches.

I using an older operating system that requires less resources from the today’s perspective. That means that I’ll use the DOS or Windows 2000 operating systems whenever I do not need to evaluate a specific feature. We can still  simulating a TCP station, like an e-mail, Web or FTP client.

Another approach is to change some parameters for the VM. I am assigning enough CPU time for the VM to work smoothly and in the same time balancing with the occupied amount of the RAM. However, changing these parameters  can dramatically slow down the virtual machine.

 

Finding a weak link

I discussed in the previous post all possible parameters that we can be change and how they will influence the work of the virtual machines. I made a couple of scenarios and series of the tests.

When we make any test, we must have some baseline level to which we referring all other results. Therefore, I created a new VM of the Windows 2000 machine with the default parameters. I compared them with those assigned to my VM.

Default

My machine

RAM [MB]

168MB

128MB

Chipset

PIIX3

ICH9

Execution cap

100%

40%

Paravirtualization interface

Default

Default

Hardware virtualization

Enable VT-x

Not checked

Mouse type

USB Tablet

PS/2 Mouse

Video RAM [MB]

16

12

Video acceleration

None

None

 

Be informed that I have specific needs and my tests in the virtual labs are mostly oriented to the IT infrastructure and networking simulations. Maybe you have different needs and should pay attention on the another parameters that did not influenced operations for my VMs.

The general conditions for the test were:

  • Tests are performed under the Oracle VirtualBox 5.1.6
  • Only this one VM is running.
  • The guest machine had the latest VirtualBox integration services and drivers installed
  • The host was not under any additional load.
  • I used the Windows Notepad to write down the results.
  • Only the usual drivers and services are running on the host.
  • All folders related to the VirtualBox are excluded from the antivirus real time scanning.
  • The host machine have about 6 GB free out of 8GB of RAM.
  • We measured the time from the starting of the VM until the icons appear on the desktop.

Due to use of the mechanical stopwatch to measure elapsed time, differences of up to two seconds are ignored and the results are considering as the same.

 

Test #1

In the first test, my virtual machine will use only 40% of the processor’s execution cap.

I chose this lowest level as I considered that the Windows 2000 was designed to work on the very slow Pentium II computers. In addition, this is a bit old system and a support for the integration services can be poorer comparing with Windows 7 and newer operating systems.

Time

VRAM size [MB]

chipset

Video acceleration

Paravirtualization interface

Mouse type

Hardware virtualization

5:32

12 ICH9 no acc. Default PS/2 Mouse

2:01

12 ICH9 no acc. Default PS/2 Mouse

Enable VT-x

1:59 32 PIIX3 2D acc. Default USB Tablet

Enable VT-x

When we analyze these results, we can see that the parameter of the hardware virtualization can significantly improve performance. I am not sure why it was unchecked.

Furthermore, even if the operating system is older, that does not means that we can decrease execution cap to the minimal value without the performance penalty.

In this case, other parameters will not affect the start-up process. They can be important only if we need to use specific application that can benefit from those settings.

 

Test #2

I decided to increase the processor’s execution cap to 70%.

Time

VRAM size [MB] chipset Video acceleration Paravirtualization interface Mouse type

Hardware virtualization

0:54

12 PIIX3 no acc. Default PS/2 Mouse

Enable VT-x

0:56

12 PIIX3 no acc. Default USB Tablet

Enable VT-x

0:53

32 PIIX3 2D acc. Default USB Tablet

Enable VT-x

 

We can conclude that more processor time and enabled hardware virtualization will significantly improve performance. In addition, we should considering larger percent of the execution cap, but less than 100%, to enable higher density of the virtual machines on the same host.

 

Test 3

The third test was made with the full processor’s execution cap.

We will have all benefits and the power of the single processor core. I also tried to disable hardware acceleration. I do that just for academicals purposes, to give us better insight. In such case, we can compare the difference between two virtualization modes.

Time

VRAM size [MB] chipset Video acceleration Paravirtualization interface Mouse type

Hardware virtualization

0:58

12 ICH9 no acc. Default

PS/2 Mouse

0:57

16 ICH9 no acc. Default PS/2 Mouse

0:56

16 PIIX3 no acc. Default PS/2 Mouse

0:37

16 PIIX3 no acc. Default USB Tablet

Enable VT-x

 

The conclusion is more than obvious. We can have acceptable performance even in software emulation. Those improvements are on the level of the lesser processor execution cap with enabled hardware acceleration.

 

Test #4

As the last test, I made a comparison of the paravirtualization interfaces. I also decided to check the 2D video acceleration.

I disabled hardware acceleration in all tests except the one. This one test with acceleration was just for the cooperation.

Time

VRAM size [MB] chipset Video acceleration Paravirtualization interface Mouse type

Hardware virtualization

0:57

32 PIIX3 2D acc. Default

PS/2 Mouse

0:41

32 PIIX3 2D acc. Default USB Tablet

Enable VT-x

0:57

32 PIIX3 2D acc. Legacy PS/2 Mouse

1:00

32 PIIX3 2D acc. Minimal PS/2 Mouse

0:56

32 PIIX3 2D acc. Hyper-V PS/2 Mouse

1:01

32 PIIX3 2D acc. KVM PS/2 Mouse

 

These results are not a surprise for us. We tested older Windows operating system. Therefore, it will not utilize full power of the Hyper-V interface; like that can do Windows 7 and newer systems.

 

What I have learned?

From these results, we can conclude that we need hardware virtualization to archive maximal performances. Therefore, we should always enabling the option Enable VT-x/AMD-v.

We can gain further improvements if we replace the default virtualization interface. In conclusion, always choose the  interface that will best fit the VM.

To avoid overloading the CPU inside the host system, we can decrease the execution cap. Two machines with 50% execution cap and the hardware virtualization could still operate with the satisfactory performance. We can use the lower execution cap without problems as far as the clock inside the virtual machine is accurate (no slowdowns) and the response on events (mouse clicks and keyboard input) from the virtual machine is good.

This tuning with the processor time will allow us to have more virtual machines running at the same time. That is our goal. In complex scenarios, we can have running 10-15 virtual machines in the same time and without slowdowns.

We must install integration services on any virtual machine, if the operating system is supported. A lack of them can slowdown the VM.

Based on this experiment I optimized all VMs in the lab. Even if my original configuration was not optimal, it was very near it. Moreover, in most cases the problem was boot time. As usage progress, I rarely saw any problem. My goal is to build a large smooth working lab that can be used for any purpose, for learning, testing or presenting.

Do not be afraid to make mistakes. Furthermore, do not afraid to experiment. That is the path to wisdom. You will not make mistakes only if you do not work on it. Be ready to bravely go when no one gone before.

WARP 6, engage!

Advertisements

One thought on “Troubleshooting poor performances of virtual machines in an Oracle VirtualBox

  1. […] Although I am using Oracle VirtualBox (referred to as VBox from here on out) for these demonstrations, you can use any other virtualization solution in a very similar way. We don’t need any special features of the virtualization solution. You should only optimize your VMs based on the settings related to your environment. You can find my guides about VBox environment here and here. […]

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s