34

I'm trying to see how our web pages behave on an average customer's computer. We have not yet pinned down this configuration, but it's likely to be slower than what our developers and testers will have.

I've seen answers to similar questions that suggest throttling bandwidth and using a VM where the memory has been limited, but do I also need to slow down the CPU? I am under the impression that the CPU will run fairly close to full speed, even in a VM. Are there virtual machine platforms that allow you to limit the CPU cycles? I saw one suggestion to run something like Folding @ Home, but I would welcome other suggestions to throttle the CPU speed.

I've seen this question: How to Slow down the browser, and others that talk about limiting bandwidth.

Edit: I suppose I need to be concerned about how many cores/processors are available to the VM as well. Do most VM platforms give you the option of limiting this?

Community
  • 1
  • 1
Bernard Chen
  • 6,437
  • 5
  • 23
  • 27
  • possible duplicate of [Is there a way to throttle javascript performance to simulate a slow client](http://stackoverflow.com/questions/8521683/is-there-a-way-to-throttle-javascript-performance-to-simulate-a-slow-client) – Bergi Jul 08 '14 at 19:58
  • Does this answer your question? [How To Simulate Lower CPU Processor Machines For Browser Testing](https://stackoverflow.com/questions/1928534/how-to-simulate-lower-cpu-processor-machines-for-browser-testing) – Alex K Oct 21 '20 at 10:43

8 Answers8

35

This is a fast solution, but not very accurate when it comes to end-user specs, but it helps a lot to test things on slower systems:

Go to Power Options -> Create a power plan -> Change advanced power settings and set CPU Maximum Rate to 5% or how much you need.

This usually helps test browser apps on slower configs.

CatalinBerta
  • 1,604
  • 20
  • 20
9

In multi core systems running vista or better you can set the cpu affinity forcing the browser to run only on a single core

For example

c:\windows\system32\cmd.exe /C start /affinity 1 notepad.exe

Individual cores on most machines these days aren't significantly faster than a couple of generations ago. That said you will find that due to architecture changes the cache is probably larger and the ram will be faster both of which make a significant difference.

Have you considered just buying an old pc from ebay or your local free adds. I suspect the cost in wages of having a member of staff do the necessary research, set up your limited ram vm and add core binding shortcuts for the major browsers etc would buy you a fair few old boxes, complete with older os (and if you're really lucky all the last owners spyware and browser toolbars for an extra accurate simulation of your end users pcs)

Robb
  • 3,801
  • 1
  • 34
  • 37
  • 1
    I suppose I was hoping to find a VM platform that can limit what CPU the VM can use or simulate a less capable CPU, but the lack of responses makes me think this isn't available. I'm choosing this answer for the information on how to at least limit the cores. – Bernard Chen Jan 14 '11 at 21:23
  • @Bernard Chen - Dos Box simulates a 386/486 and can have win 3.1 or 95 installed on it, however I suspect that's going back a bit too far for your users. There's another thread on SO that seems to have a few ideas on it too http://stackoverflow.com/questions/284051/emulate-old-pc Good luck! – Robb Jan 17 '11 at 10:30
  • Will this really slow anything down at all? I Mean... I don't see Netepad beting able to run on more than one core anyways. Are modern browsers able to render pages and running scripts using multiple cores? – Jan Aagaard Apr 18 '13 at 07:12
6

Adding to CatalinBerta's answer which worked great for me. You also need to keep in mind that it's not just the CPU you want slow down.

Browsers typically rely on GPU's for painting and composting the webpage as well as for complex animations. If you want to simulate worst case scenario, try disabling all of your Display Adapters in Device Manager, which will closely resemble clients using computers at public libraries.

For Windows:

Start > search "Device Manager" > Expand Display Adapters > right click each item > Disable

Community
  • 1
  • 1
Neek Sandhu
  • 91
  • 1
  • 5
4

Seems like it would be simpler to acquire an "average customer's computer" on the used computer market.

Or build it yourself from parts.

Gilbert Le Blanc
  • 50,182
  • 6
  • 67
  • 111
  • 1
    That may ultimately be the approach we take. To make this a shared resource, we may enable some kind of remote access. – Bernard Chen Jan 12 '11 at 20:39
  • In our shop, the demonstration computer is the slowest computer. It has access to our network drives, but we access the computer in the demonstration room. – Gilbert Le Blanc Jan 12 '11 at 20:41
  • 5
    This is a terrible suggestion. At minimum, you could run a VM and throttle it's cpu usage to solve this problem. Unless you have spare parts sitting around I fail to see how spending probably at least $100 USD to build a computer would be better than a VM. – Taylor Rose Jan 20 '15 at 19:54
2

I created a free simple tool for Windows that allows anyone to enter the process ID and the desired CPU speed percentage, and it proceeds to simulate a slow CPU for that process. The utility itself barely consumes CPU time, which is a benefit. :)

It's called "Slow CPU Emulator", check it out here: https://github.com/mathusummut/SlowCpuEmulator

Precompiled binaries can be found here: https://sourceforge.net/projects/slowcpu

MathuSum Mut
  • 2,765
  • 3
  • 27
  • 59
  • First off, the application itself is self-explanatory and is user friendly, so usage notes are not required. Secondly, the answer directly addresses the issue mentioned in the question, where the browser process is to be slowed down. Thirdly, sample code is not relevant, and the tool itself requires no coding. And finally, the tool is free and open source as already mentioned in the answer. Please read the answers before copy and pasting comments like this, thanks in advance. – MathuSum Mut Nov 28 '18 at 06:29
2

For MacOS/Linux, there is cpulimit.

To install on Ubuntu:

sudo apt install cpulimit
luboskrnac
  • 23,973
  • 10
  • 81
  • 92
1

Found a solution for this on Mac as well.

http://jesperrasmussen.com/blog/2013/03/07/limiting-cpu-cores-on-the-fly-in-os-x-mountain-lion/

Using the instruments app, you can limit the CPU usage of one or all running processes.

Taylor Rose
  • 763
  • 5
  • 6
1

VirtualBox can customize virtual machines to run on only limited CPU cores and RAM. it could help a bit.

person the human
  • 345
  • 4
  • 15