Slow performance in VMWARE using Ubuntu ?

WMWare does not really work out of the box on Ubuntu.

There is an issue concerning the ACPI, which makes the guest machine so slow that it is barely usable.

If you do on your terminal :

$ cat /sys/module/processor/parameters/max_cstate

You will probably get a value bigger than 1. In my case, it was 8 (default in Ubuntu, I guess). This value is related to the number of level that the processor takes to save energy (reducing its performance and power consumption when idle).

For a try, fix it to a smaller value and check how VMWare is going :

$ sudo -s
$ echo 3 > /sys/module/processor/parameters/max_cstate

I think 3 is a good compromise. At least it is working very well on my machine, no slow down at all. If you still have the issue, reduce it to 2 or even 1. The side effect is that your laptop will be a little bit more power hungry, but so little that you probably won’t see any difference.

If you stop here, you will loose the change at the next startup. To have it set on boot, edit the /etc/init.d/acpid file.

Add the line at the end of the function named load_modules() :

echo 3 > /sys/module/processor/parameters/max_cstate

I found out the solution thanks to this article. Go there for more info or alternative solutions (including for different systems).

I hope this will be helpful.

17 thoughts on “Slow performance in VMWARE using Ubuntu ?

  1. phocean

    Actually I didn’t express myself well. I found out the solution in the ubuntu forums, where there are many posts concerning this problem. But the problem being related to the max_cstate parameter, the link given as "this article" provided the best solution. I found that having it set at startup and for all applications is more elegant that having a script requiring root access every time you launch VMWare. Therefore, the solutions given in the "Limit ACPI CPU power states" paragraph are suitable even though it is not the same subject. Sorry that it was really not clear.

  2. Benjamin Hawkes-Lewis

    The link "this article" is not about VMWare at all, but about "Problem with high pitch noises" on Thinkpads. Are you sure you linked to the right article?

  3. Fipu

    Thank you for this article!
    Finaly i had to:
    echo 1 > /sys/module/processor/parameters/max_cstate
    /etc/init.d/vmware restart

    I use Ubuntu 6.10 on a Dell Inspiron 6000. The guest os is xubuntu. To test the speed i entered a "time sleep 1" command on the guest os. Before this hack it took 30 seconds. But the consumed time displayed 1 second. I tested with VMware-server-1.0.1, VMware-workstation-5.5.2 and VMware-player-1.0.3. The result was allways the same.

  4. Donovan Freemyer

    Thanks for posting !!! This fixed my problem. I’ve been pulling out my hair trying to find a solution.

    Donovan

  5. solussd

    thanks for the tip! That did it. I’m using Kubuntu 7.10 (Gutsy). I also set my cpu frequency to ‘performance’ as it seems it doesnt change (quick enough) for the guest.

  6. Andrew

    You are a GOD! Here I was stressing that my 1.5 GB wasn’t enough, and I’d have to rip it all out to just to bump it up to 2 GB. But all is well now! Thanks again!

  7. Aaron

    I am having a similar problem – I have a dual core 3GHz with 4GB of RAM and a 7200 rpm hard drive with Ubuntu. I am running XP with vmware. When I first start up the vm, everything seems to run fine. If I let the vm sit idle awhile (an hour or so), when I come back, it slows to a crawl. Minimizing an app (or doing anything, really) it just hits the hard drive constantly. Right now, it is still loading an app that I started a few minutes ago.

    I have the max_cstate set to 1.

    Ubuntu System monitor:
    vmware-vmx – Virtual Memory = 1.7GB, Memory = 0

    VMware workstation settings for the xp vm:
    – Memory = 2048MB (on the right the slider is well below the max recommended – which should prevent swapping)
    – Processors = 1
    – Hard Disk 40GB pre-allocated

    in the winxp vm:

    Many thanks for any assistance.

  8. JC Post author

    Hmm the output from the system monitor is weired, you can’t have a process not using memory at all (the virtual memory is huge but matches with the way you configured your VM).

    I advise you to use “top” in a terminal, as root, to get some reliable info.

    Concerning your performance problem, you should not swap within the virtual machine with such an impressive of allocated memory.

    How much physical memory do you have ? Maybe, the problem is that your machine lacks of memory and makes your Ubuntu swapping…

    To boost performance, I use the following settings :

    (1) in the options of VMWare, I deactivate “taking snapshots in the background” and, in the memory section, I force all the virtual memory to fit in the available physical memory (no swap)

    (2) I also adjust the swappiness parameter of the linux kernel.

    By default, the linux kernel uses quite often the swap even if you still have plenty of free memory.

    You can change this behaviour with this command :
    echo “15” > /proc/sys/vm/swappiness

    I use “15”, which gives a pretty high priority to the physical memory, before the kernel uses the swap. By default, the value is 60. The higher, the more it will use the swap.

    After testing, you can make it permanent by adding such a line at the end of /etc/sysctl.conf :

    vm.swappiness = 15

    (3) I would, anyway, just try to reduce the memory amount you allocate to you VM. Just in case.

    (4) Also check the processes runing on your XP when it is slow ! Are you sure that your Windows image did not get infected by some trojan or virus ?

    (5) For graphics, did you set up VMWare tools ?

    Let me know how it goes.

  9. Aaron

    In the system monitor:
    Memory: 3.2GB
    Processor 0: Intel Core2 6600 @ 2.4GHz
    Processor 1: Intel Core2 6600 @ 2.4GHz
    Available disk space: 133.6GB

    Tools is installed.

    I had to exit workstation and sudo from the command line in order to modify options on the memory tab under preferences…

    Host RAM for all virtual machines: slider is all the way to the right – 2965MB.
    Fit all vm memory in reserved host ram is selected.
    Under the priority tab, I unchecked the take and restore snapshots.

    When I started workstation up after I made the changes, I had to reopen the vm (the vm tabs were gone). No big deal, but…

    I’ll test the swappiness after these changes.

    OK – I’ll keep you posted! Thanks for your help.

  10. Derek Shaw

    The swappiness setting fixed it for me
    VMWare workstation 6.0.3 for linux (ubuntu hardy desktop 8.04)
    I was running two win2k images (VMs) in 1.5 GB of RAM with both VM’s limited to 500 MB RAM, and they became unusably slow when both were running. Alone they were fine.

    changing swappiness fixed it.

    happened on two separate boxes.

    max_cstate is not available for default kernel of unbuntu hardy desktop (8.04)
    https://bugs.launchpad.net/ubuntu/+source/linux/+bug/206864
    http://www.mail-archive.com/linux-acpi%40vger.kernel.org/msg10354.html

  11. Juan Gorritz

    JC you are my hero. VMWare 6.5 and Intrepid Ibex were driving me insane. Changing the swappiness to 15 helped BIG TIME.

  12. fasholaide

    This is the response I get for both LinuxMint 12(Lisa) and Ubuntu 12.10:
    cat: /sys/module/processor/parameters/max_cstate: No such file or directory

  13. phocean Post author

    @fasholaide:

    The kernel of Mint and Ubuntu is compiled (at least for intel architectures) compiled with the CPU_IDLE option :

    $ grep CPU_IDLE /boot/config-3.2.0-23-generic
    CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
    CONFIG_CPU_IDLE=y
    CONFIG_CPU_IDLE_GOV_LADDER=y
    CONFIG_CPU_IDLE_GOV_MENU=y

    This option obsoletes the max_cstate interface. See this thread for more details:
    https://lkml.org/lkml/2007/11/30/281

    Unfortunately, it seems that CPU_IDLE may cause troubles with VMWare.

    Beside recompiling your custom kernel to deactivate this option and restore max_cstate, I don’t know if there is a solution.

    I suggest that you try to ask a linux kernel guru in a specialized forum or in the VMWare forum.
    I would appreciate your feedback, and will update the article accordingly.

  14. asdf

    “no such directory” and no version of ubuntu given, so this may have been useful in the past but it sucks ass now

  15. phocean Post author

    2006… and I don’t owe you anything and Google is your friend… I recently found the new way very easily.

Comments are closed.