KVM - The Linux Kernel-Based Virtual Machine
News, Blogs and Resources on the Linux (KVM) Kernel-Based Virtual Machine

Settings for best perf

6 replies [Last post]
nielsb
Offline
Joined: Sep 14 2008
Points: 0

Hi all!

I'm a new user of KVM (qemu-kvm), I have however used other VM products previously. My situation is that I'm running Archlinux x64 on my MacBook Core Duo 2 with 4 Gb of Ram. I need to run Windows Server 2008 (x86) VM's in a teaching scenario (teaching Windows developers how to use latest technologies), so I make heavy use of Visual Studio etc., inside my VM.

My question is what are considered best practices to get the best performance out of the VM (at the moment I have assigned the VM 2048 meg of memory):

  1. Should I run the VM under 2 cpu's (-smp 2), or is it better to use just one (as my laptop is dual core I can simulate multi CPU's)?
  2. In the case of running under just one CPU would it be better to peg the VM to one specific cpu  as I believe I've seen some setting under qemu-kvm, which allows me to peg my VM to a specific CPU.
  3. After starting up the VM with -std-vga, I manage to get OK video. The mouse is still somewhat slow, is there any workaround for that?

Thanks!

Niels

Haydn Solomon
Offline
Joined: Mar 7 2008
Points: 458
Re: perf settings

Looking at your questions,

  1. There have been some stability issues with running -smp 2 with certain guests so my opinion is to run without using -smp 2. There should not be any noticeable performance hit anyway.
  2. As far as pegging to specific cpus, you can if you really want affinity to a specific cpu. However, you might actually get better performance if you don't peg to a specific cpu.
  3. I'm not aware of a work around for slow mouse with -std-vga.
nielsb
Offline
Joined: Sep 14 2008
Points: 0
Thanks Haydn!   Niels

Thanks Haydn!

 

Niels

falstaff
Offline
Joined: Oct 2 2008
Points: 0
Best Performance

1. I used Windows XP with -smp 1, which worked pretty well. But then, I used Windows XP with -smp 2 and ACPI, and I get a performance post, even when I boot up Windows XP! So if it works with -smp 2, I would recommend to use -smp 2...

2. No idea, I dont use it...
3. I had this "issue" too. I now use rdesktop to work, i think I have a much faster response to klicks/mouse movements.... But I have sometimes some painting problems....

The secound reason to use rdesktop are the hotkeys.. I can now use Windows+R (Run), Alt+Tab and some other hotkeys which didnt work with -std-vga. I use this command to connect to my Virtual machines:
rdesktop -uusername -rsound:off -rclipboard:PRIMARYCLIPBOARD -5 192.168.x.x -g1920x1200 -D -x l

With this options, i can use all hotkeys I need. To go back to the linux desktop, i set up the exposé feature from Compiz, which is triggered when I go to the right lower edge of the desktop.

bye
falstaff

nielsb
Offline
Joined: Sep 14 2008
Points: 0
Re: Best Performance

Falstaff, thanks a lot - I'll definitely have a look at rdesktop.

It is interesting how you see a perf increase using -smp 2, I seem to get worse perf (but I have no hard figures, it's more a feeling).

Niels

sw2wolf
Offline
Joined: Mar 18 2009
Points: 29
-smp 2 seems slower for me

-smp 2 seems slower for me

Gyula Csom (not verified)
Red Hat guides

Hi,

Regarding the 1st question some Red Hat guides might help:

1./ About overcommiting resources
It seems that you should not overcommit SMP guests, just use VCPUs up to the number of phys cores.

"Virtualized CPUs are overcommitted best when each virtualized guest only has a single VCPU. The Linux scheduler is very efficient with this type of load. KVM should safely support guests with loads under 100% at a ratio of 5 VCPUs Overcommitting single VCPU virtualized guests is not an issue.

You cannot overcommit symmetric multiprocessing guests on more than the physical number of processing cores. For example a guest with four VCPUs should not be run on a host with a dual core processor. Overcommitting symmetric multiprocessing guests in over the physical number of processing cores will cause significant performance degradation.

Assigning guests VCPUs up to the number of physical cores is appropriate and works as expected. For example, running virtualized guests with four VCPUs on a quad core host. Guests with less than 100% loads should function effectively in this setup."

See the full guide here: http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5.4/html/Virtu...

2./ How VCPUs handled
It seems that each VCPU is handled as separate Linux processes, thus it might be tuned in the regular Linux way (eg. CFS scheduler settings, CGroup controls).

"In the KVM architecture the virtual machine is implemented as regular Linux process, schedule by the standard Linux scheduler. In fact each virtual CPU appears as a regular Linux process. This allows KVM to benefit from all the features of the Linux kernel."

See the full guide here: http://www.redhat.com/f/pdf/rhev/DOC-KVM.pdf. It is a strong overview article on both virtualization technology in general, and KVM in special.

Though I haven't tested the above, yet. Anyone with some experience? whether VCPUs are really, separate Linux processes?

Cheers,
Gyula

Post new comment

The content of this field is kept private and will not be shown publicly.
Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.