How can I simulate a slow machine in a VM?

29

5

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.)

Nathan Long

Posted 2011-06-15T13:40:41.780

Reputation: 20 371

Answers

17

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.

harrymc

Posted 2011-06-15T13:40:41.780

Reputation: 306 093

7

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

pfrenssen

Posted 2011-06-15T13:40:41.780

Reputation: 481

4

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...

jpaugh

Posted 2011-06-15T13:40:41.780

Reputation: 1 212

2Ha! Interesting idea to buy an actual machine. Since the whole idea is to emulate an old computer, buying an old computer is a pretty cheap option. :) – Nathan Long – 2011-07-01T19:39:13.200

2

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.

Kirk

Posted 2011-06-15T13:40:41.780

Reputation: 2 182

2

One surefire way to make a VM slow is boot up as many clones of it as you can along side it!

Your processor, FSB, RAM and all the other fast components of your machine will be sliced and diced between the other VMs (As long as you have them doing something intensive - One of the openGL screensavers for example), and you'll feel like you are in 1990 again...

Haqa

Posted 2011-06-15T13:40:41.780

Reputation: 549

Simple and quite effective. – rolls – 2019-04-08T01:40:29.047

1

Install a little utility in the guest XP VM to control the CPU frequency using XP's built-in dynamic frequency switching. For example, a utility like SpeedswitchXP. I have never tried something like this myself, and there may be problems potentially if the virtual CPU that VMWare presents to the guest VM does not support dynamic frequency switching.

queso

Posted 2011-06-15T13:40:41.780

Reputation: 752

1I fear this will have little effect for a VM, where the CPU is only emulated. – harrymc – 2011-06-25T08:49:29.650

1Yeah, I don't think changing the frequency is an option; it would either not work (likely), or throttle the whole host os (impossible?). – jpaugh – 2011-06-28T00:43:43.900

0

I would entertain the idea of using an infinite loop thread with a tunable sleep command and set the process priority. If you want me to slap together a quick chunk of C code let me know.

RobotHumans

Posted 2011-06-15T13:40:41.780

Reputation: 5 758