Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I set up an host Linux system with KVM and I installed another Linux as a guest (Debian 6). I nside the guest I launch a vncserver and I access it from the host using vncviewer. It works fine for my simple needs.

I've got a few related questions and, overall, I was wondering if anyone had tips as to how I could speed up my KVM (Debian Linux) guest a bit. VNC isn't an issue: graphically the guest is responding fine.

For example are there specific things I could do on the guest side to speed it up, like installing some specific drivers?

I'm doing the experiments on a 64-bit capable system with 4 GB of RAM but both the host and guest are 32 bit. Would the perfs go up if I were to switch one (or both) of them to 64-bit?

Any other tips to speed up virtualization using KVM from other KVM users?

Here's the output of the free command as suggested by Paul:

             total       used       free     shared    buffers     cached
Mem:        513828     465796      48032          0       7552     140624
-/+ buffers/cache:     317620     196208
Swap:            0          0          0

Apparently I don't have any swap file setup and maybe 512 MB is a bit short.

Here's top -c 's output but I don't know how to read it:

 1006 cedric    20   0 23584  16m 1524 S  2.0  3.4  35:13.52 Xvnc4 :1 -desktop d
 5801 cedric    20   0  132m  32m  16m S  1.3  6.4   1:16.10 /opt/google/chrome/
 5689 cedric    20   0  405m  71m  29m S  0.3 14.3   1:29.06 /opt/google/chrome/
 5830 cedric    20   0  251m 120m  21m S  0.3 24.0   0:30.14 /opt/google/chrome/

That's with 3 Chrome tabs.

If memory is an issue, how can I add a swap file to the guest and does it make sense to add swap memory to a guest?

share|improve this question
If the vm is responsive via a graphical interface, then what types of activity would you like to see a performance increase in? – Paul Oct 17 '11 at 22:46
@Paul: once I start having something like 6 tabs in Chrome it seems to get quite slower. I'm looking for any tips: memory settings, type of swap (file or fake partition etc.), anything : ) – Cedric Martin Oct 17 '11 at 23:43
How much of the 4GB is the guest allowed? It sounds like a memory issue, but you'd can use the usual tools to work it out - free, top -c etc – Paul Oct 17 '11 at 23:53
@Paul: thanks for the help, I pasted the output of free and top -c but I'm not to sure about how to read/interpret it and what to do to "fix" the slowness issues (btw it's on a quite fast machine). – Cedric Martin Oct 18 '11 at 0:13

If you are using this with a desktop environment, I would recommend doubling the ram, and make sure the guest has access to all cores.

And definitely add swap so it can make more efficient use of ram. There is free physical, but by the look of it the next tab would hit the limit, leaving no room for caching, which will lead to slowdowns.

It depends on your KVM setup how you would add a swap file. The simplest way would be to add a new disk to the guest, say around 2GB big. You'll need to confirm what this presents as in the guest, but assuming it appears as /dev/sdb you can then do

mkswap /dev/sdb

If it complains about using a full disk, just confirm (make absolutely sure you have the right disk or you'll wipe data).

Then edit /etc/fstab and add

/dev/sdb      none    swap    sw      0       0

Then do

swapon -a

Using a 32bit guest is best where they use less than 4GB. However, you'll want to make sure you are using a PAE kernel on your host to make sure you get full access to the 4GB, so type on the host:

dpkg --get-selections | grep linux-image

If you see "bigmem" or "pae" you are fine.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .