Make sure your rig will survive the rigours
of your demands on it with a stress test
If there's one thing Linux is good at, it's
stretching hardware to its limits. Whether that's a diminutive ARM CPU
sprinting like a caffeinated hamster within a Raspberry Pi, or the
behemoth-sized computing grid that spreads its fronds across Europe as it
crunches through the petabytes of data produced by the Large Hadron Collider;
Linux works very hard.
Burn-in
your CPU with Linux
This is because the kernel, the chunk of
code at the heart of the operating system, has been optimised to make best use
of any and all resources available to it, whether that's a tiny CPU or a
network of many thousands. Unused memory isn't left waiting, spare CPU and GPU
cycles are assimilated and storage space parallelised, forked and RAIDed.
All of this means Linux is a particularly
good option if you want to push your hardware to its limits. If your CPU can
survive a few days under constant load from the Linux kernel, you can be fairly
certain it won't fail half-way through a weekend's gaming session. Similarly,
if you want to run a Linux machine as a server and hide it in the loft, you can
be sure it won't fail before you put the ladder away.
Burning-in your hardware used to be a good
way of optimising CPU performance, the theory being that stressing the silicon
at an early stage would enable you to squeeze out lower voltages and higher clock
speeds. This may not be as true with modern processors, as most are effectively
'burned-in' at the class testing stage of manufacturing, but that doesn't mean
burn-in isn't s till useful. It is, because it enables you to discover the
weakest links in your configuration, ensuring the chain of reliability that
starts with your PSU and ends with your GPU operating under heavy load is up to
whatever task you throw at it, giving you confidence in your cooling provision
and system performance. Whether you overclock your system or not, this
confidence is essential.
Simple solutions
As you might expect from an OS that
flourishes because of user choice, there are many different ways of putting
your system under serious load. It shouldn't matter which distribution you're
using, or the age of that distro, the package manager will be full of utilities
that will stress your CPU. If you don’t have Linux installed, you could easily
use one of the many Live CD/ DVDs available that will boot to a working Linux
environment with no effort other than placing the disc in the drive and making sure
your system boots from it. We'd recommend the latest Ubuntu if you've not used
Linux recently as it’s compatible with the widest amount of hardware while
remaining easy to use. You can even run some simple tests from most boot menus,
as many distributions include 'memtest', which will grind its way through your
memory looking for problems. But when you do get to the Linux desktop, you
don't need to install anything if you don't want to. For a very quick and easy
fix, you could, for instance, open the command line terminal and type this:
whiledodone This is a very simple Bash script (Bash is the flavour of command
line most Linux distros enable by default). It creates an infinite loop that
should keep your CPU occupied at 100 per cent. For other cores and CPUs, you'll
need to manually run other instances of the same command. You can do this by
opening other terminals or adding a new tab to the current terminal. Butthere
are several shortfalls in this approach. Despite the 100 per cent CPU usage,
it's not using the various parts of your CPU equally. There's a good chance the
FPU isn't being touched, for example, which might affect the overall efficiency
of your CPU cooler. For this reason, it's worth using a tool designed
specifically to put your CPU under load. And from the command line, this is
easily done by installing another command 'stress'. But before you move on,
press [CTRL] + [C] in the terminal sessions to force exit the infinite loops we
created.
We'd
recommend the latest Ubuntu if you've not used Linux recently as it’s
compatible with the widest amount of hardware while remaining easy to use
Stress by name
'Stress' isn’t a comprehensive solution,
but it is going to be powerful enough for most circumstances. Also, because
it’s designed specifically to put load on your system, it does a better job at
using the entire instruction set of your CPU than Bash commands, as well as
other components, such as memory and storage, if you let it. Once installed,
typing stress on the command line will output a simple set of arguments for its
use. Adding --cpu 2, for example, will spawn two tasks constantly working out
the square root of a number. You can add memory allocation/ deallocation with
the —vm 1 argument, followed with -vm-bytes 128M for the amount of memory you
want to process to play with. Finally, if you want to add some file system
input/outputto the mix, add the —io 1 argument. This will force the file system
to constantly flush its buffers, as the Linux community likes to say. Putting
this together, you should use this command: stress --cpu 2 —vm 1 —vm-bytes 128M
—io 1.
After running this command, you should find
that your system is operating under considerable load, hopefully to the point
where it may become slightly unresponsive, although not too much; the Linux
scheduler is excellent at maintaining interactive sessions while experiencing
periods of heavy load. If you wantto understand a little more about
whatthestress command is doing, add the —verbose argument. This will provide
some background information on what the tool is actually doing to your system,
as well as report on how the processes are running. But if you want to see more
about how your system is coping with the load, you'll need to look at a couple
of system utilities.
Monitoring your CPU
The perennial command for monitoring a
Linux system is called 'top'. There isn't a Linux distribution, or even a UNIX
installation, that won't display a dynamic process list, along with the
distinctively cryptic usage table, when you type this command. The process list
is sorted by usage, with the most CPU hogging tasks at the top. If you’re still
running the previous ‘stress' command, you should see four separate 'stress'
processes. These equate to two for the CPU tasks, one for the memory allocation
process - this should be obvious from the size of the 'VIRT' column -and one
for the file system input/ output. Anything else that's fighting for contention
should be bubbling up and down among these tasks. The top table displays the
uptime for your machine, how many users are logged in and the trinity of the
'load average', which makes no sense if you've not encountered it before, but
they are important for monitoring your system overtime. This is what it looks
like for us: load average: 1.14,0.78,0.20.
Use
htop to get a slightly prettier representation of your data
Those three numbers represent load average
over progressively longer periods of time; 1,5 and 15 minutes, from left to
right, and the number represents the demand being placed on your CPU. Note that
1.0 is the equivalent to 100 per cent of a single CPU (2.0 would be the
equivalent of 100 per cent across two CPUs, if this is your system
configuration), and that's with no other processes waiting to use the CPU,
whereas 0.5 is 50 percent of a single CPU. In our system, over the previous
minute, the CPU capacity was overloaded such that 0.14, or 14 per cent, of
processes, were waiting to run. The previous measurements show the state of the
system as we stopped and ran stress, taking the CPU to roughly 80 per cent and
20 per cent. This is why server admins look horrified if they've got a number
over 0.8 for either the 5 or 15 minutes entries, because it means (unless
you're being Slash dotted) there's some wayward process running wild on the system.
If you want a prettier alternative to 'top1 without going all graphical, many
distributions include 'htop' which presents the same information, only in a
slightly more eye-friendly format.
StressLinux
As effective as the solutions we’ve covered
are, they're not designed for burn-in testing, and while you could easily
litter your Linux installation with further package installation, this is one
of those times where a specific Linux distribution makes a lot of sense. Using
a Live CD instead of an installation, for instance, safeguards your personal
data should testing result in a system restart or total failure.
StressLinux
includes tools for stressing your CPU, memory, network and storage
There are several distributions that can do
just this, but our favourite is the aptly named Stress Linux. Unlike Ubuntu,
it's a no-frills distribution that simply packages the tools you need to test
your hardware and nothing else. The advantage to this is that it’s a small
distribution, with the 64-bit ISO download taking around 220MB, and there are
images for both USB sticks and a VMware appliance if you need alternatives.
On first boot, choose the default option
from the Start menu, and a few moments later, you'll see the login prompt. The
default login and password is 'stress' for both, after which you'll be asked to
choose a keyboard layout followed by a script called 'sensors-detect'. See the
box' Temperature monitoring over the page for further details, otherwise, skip
this step by selecting 'no’ for every option. You'll then be dropped back to
the command line, where you'll see a useful list of included utilities.
Burn utilities
In the list of utilities, you'll see
'stress' as well as other tools that will put your storage and networking
through the ring of fire. But the ones we're interested in are the 'burn' commands.
These are designed to specifically heat up your CPU using hand-crafted
assembler code to target every area of your silicon. The platforms supported,
as described by their names, are dated, but choosing between 'burnK7' and
'burnP6', for AMD and Intel platforms respectively, will still yield good
results on modern hardware.
You will also need to run an instance of
each command for each CPU core. But unless you've got a little Linux
experience, it won't be obvious how to do this from a single command prompt.
The answer is to either switch to a different login prompt with [CTRL] + (Alt]
and a function key, or to run the command as follows: nohup burnP6 &.
This will run the burn command in the
background and allow you to continue typing into the terminal, and you can
enclose as many commands within 'nohup' and to run as many processes as you
wish. It's then a case of making sure your fire alarm is working and leaving
your system running for a day or two. If your PC survives, it’s in awesome
shape. If not, you'll need to look into buying extra cooling or power
provision.