How can I simulate a slow machine in a VM?
I'm testing an AJAX-heavy web-application. I develop on a new Mac, but I use VmWare Fusion (currently 3.1.2) to test in Windows XP, using IETester to simulate older versions of IE.
This lets me see how older IE versions would render the site, but I'd also like to see how the site would perform on an older machine. I see in the VM's settings that I can decrease the RAM; is there a way to also dial down the processor speed? How else might I simulate a slow machine?
(I am also going to check out how to simulate a slow internet connection.)
The thread Limiting CPU speed in a virtual machine offers some advice :
- On VMWare ESX and ESXi you can create a Resource Pool and limit the CPU Resources for that pool. This would allow you limit the CPU speed of any systems created in that Resource Pool.
- Settings in MS hyper-V allow to limit a virtual machine to a percent of the overall host. So if you have a 8 core host running at 2 GHz, you could try limiting the client virtual machine to one core, and no more than 45% of the core.
The Virtual PC Guy remarks in Slowing down virtual machines that :
setting a virtual machine with a maximum of 10% CPU resource under Virtual Server (for example) means that it will only be allowed to run on the CPU for 10% of the total system scheduling time over a period of time. While the virtual machine is running, it is still running at full processor speed (albeit less oftenly than it would otherwise run).
He suggests using instead Turbo to slow-down the VM. He also suggests using emulation products, which are much slower than virtualization, such as DOSBox and Bochs.
You can use cpulimit to limit the amount of processing time is allocated to your process. This is available in the repositories for most linux distributions.
Usage is very simple, if for example your VM is running as process 12345 and you want allocate only 5% of CPU cycles to it, use the following options:
$ cpulimit -l 5 -p 12345
It's really not possible to reliably match the performance of an older machine. Even if you manage to throttle the CPU usage and the memory size, how will you throttle the FSB speed or memory speed?
Having said that, you can use the process management tool of a Mac to limit the CPU usage of VMWare Fusion itself. If you do this well enough to emulate an older machine, then the whole VMWare application will probably run really slowly--just like a vintage XP-ready machine.
I don't know what the graphical Mac program is for this, but see if your Mac supports the renice
command: Open a terminal and type man renice
to read up about how it works on a Mac.
By the way, XP-ready machines are probably dirt cheap right now. A real one could probably be had for ~$75. Then, you could transfer your virtual machine to a real one...
This really depends upon how slow of a machine that you want to emulate. If you roll XP back to 128 MB of RAM, it will be painfully slow, to the point where I'm not sure if the virtual processor speed will really be relevant. You could also run your VM files off of an old USB1 external hard drive (see if you can find a 4200 RPM drive). That should slow things down.