MacOS – How to simulate light to heavy disk access and light to heavy CPU usage

cpumacosperformance

I have a Mac Mini server that seems to exhibit various issues while there's either a medium to heavy CPU load or disk access. I'd like to test this out by intentionally triggering varying degrees of CPU usage and different kinds and intensities of disk access. Are there any tools or techniques out there that can:

  1. Load the CPU to a certain percentage, i.e. peg one or more cores of the CPU at 50%, 75%, 100%, etc.

  2. Simulate medium or heavy disk access of varying kinds, including situations like lots of random seeks or continuous reads / writes

Best Answer

The best configurable tool I've found to simulate light to heavy disk access for testing purposes is filebench.

I didn't get filebench-1.5-alpha3 to compile properly. So download an older installer package (filebench 1.4.4) from FileBench ported to Mac OS X or direct link.

Install the app. You may have to disable SIP and - in Sierra - Gatekeeper to do so. The package will be installed to /opt/filebench.

To start the app in interactive mode enter in Terminal.app:

/opt/filebench/bin/go_filebench

Now choose a workload at the prompt - preconfigured workloads can be found in /opt/filebench/config (e.g. fileserver.conf):

filebench> load fileserver

Set a working directory and other variables (most have default values):

set $dir=/tmp
set $filesize=612458

and a run time in seconds:

run 600

To create your own workloads visit filebench Wiki and check the WML link.

To "simulate" CPU-load install prime95 and configure it.


In my virtual environment (Sierra - 2 CPUs/4 GB memory) running go_filebench alone already creates a total CPU-load of 70% (go_filebench: ~140%). So I don't have to start prime95 additionally. In your environment you may have to start it though.