Stress testing your Raspberry Pi 3 Model B is simply running a series of processes on your system which are designed to run the CPU at full power, and monitor the temperature and stability of the system. Let's do it!
How to Stress Test Your Raspberry Pi 3 Model B
Hi guys how are you going? My names Sam and today we’re going to be taking a look at Stress Testing your Raspberry Pi 3 Model B. This is the second part out of 3 in our mini series on cooling, stress testing and then overclocking for the Raspberry Pi. We took a quick look at cooling in the previous tutorial and you’ll notice I’ve got my Raspberry case here with the fan and a rather large heat sink in there and we covered that set up in the previous tutorial on Cooling, so check that out but now we’re going to take a look at Stress Testing.
Now, what is Stress Testing? Well, Stress Testing is putting parts of the system under stress and seeing where the weakest link is and then in computer speak that means we’re running this whole system as high as we can, putting it under a really intense workload to see how it fares. Is the system stable, whether it overheats because as the processor churns through more and more tasks it draws more and more power and gets hotter and hotter and that heat has to go somewhere which is why we have the heat sink to cool it. Now this is particularly important because as the chip starts to get warmer its performance can start to decline and it becomes more unstable so we want to keep the system nice and cool. Now how do we do this? Well, we’re going to be installing 2 software packages on to our Raspberry Pi so one is called STRESS and the other cpuburn. So the process for Stress testing goes like this, you implement your cooling system like so, then you run STRESS and STRESS is the lessor of the 2, out of STRESS and cpuburn, STRESS is more friendly and it represents a real life, more realistic load on the system which isn’t quite 100% because in real day to day usage it varies. It might max out a bit then drop down and max out and different cores doing different things and that might give the chip time to cool down before heating up again and that’s what a real life scenario looks like. Cpuburn however, is deadly, it is crazy, it loads all of the CPU cores up to 100% unrelenting and then just destroys them and if you don’t have really good cooling, not really really destroys them! but if you don’t have good cooling it will cause your Pi to over heat I can guarantee it. A stock Pi with no cooling , just ambient air, at about a 25 degree ambient air temperature will hit 80 degrees with cpuburn in about 3 seconds! Not ideal, you want cooling for this so make sure that it is cool.
Now, we run cpuburn if the STRESS testing was stable and we run each test for 10 minutes and monitor the internal core temperature and the frequency then if it doesn’t crash or overheat in that time then we know its a pass and we can try cpuburn and if that’s a pass then we can move on and bump our overclockings up a bit and keep going until we get an unstable system then drop back to the last known stable setting and we can tweak a bit from there.
So lets crack into it. You might notice I’m using an older version of Raspbian, its before the pixel update, it doesn’t matter at all, it pretty much going to be doing everything in the terminal. So to install STRESS and cpuburn enter the commands in there to get those software packages on to your Raspberry Pi sudo apt-get install stress then follow the instructions for cpuburn as well. Now how we run these is we enter the following commands, so we’re running ‘while true which ensures that it’s going to loop do vcgencmd measure_clock arm; vcgencmd and that is going to be monitoring the state of the internal core, now we’ll monitor the temperature, now to run stress (see video at 03:43) and hit enter. Now what this is going to do is its going to load up the processor in the system and every ten seconds its going to print out the core frequency and the core temperature. Now I can see in that very first line it’s still clocking at 600MHz that’s because we’re idling and Raspberry Pi runs at a lower clock speed with a reduced power consumption which is cool and now that its kicked into gear we’re on to 1.2 GHz or 1200 MHz which is great. Now you can see in the first 10 seconds and skip over to this screen here we were clocking in at 35.8 degrees celsius and then in the next 20 seconds we jumped up almost 10 degrees to 44.4 degrees celsius but since then the temperature increases has started plateauing a bit which is what we wanted. This system just with a simple heat sink and fan is going to keep our Pi nice and cool. Now I’ve already tested this and I know that the Pi is stable under these conditions and configurations for this test but what you want to do is run it for 10 minutes uninterrupted and monitor the temperature and monitor the state of the system so if it starts not responding that you can see the system has crashed and it’s not stable. If it overheats then you either need to increase your cooling or reduce the overclock setting if you have any. I’m going to stop that now and we’re going to move on to cpuburn.
So let’s pretend that your system has passed, I know thats passed, I’ve run it in the past, and we’re going to move on to cpuburn. Now the set up is the same we go “while true (see video at 05:10) and we’re going to be doing the vcgencmg. So copy these lines in here, now this is cpuburn and I can’t stress, pardon the pun, how important it is to make sure your system is stable under the STRESS test before running cpuburn. If it’s not then don’t attempt to run cpuburn because it will plough through your system processors like nothing else.
So, we can see here after running that that we actually got an error and thats an indication that something wasn’t written out correctly so if we go back, you can press the up button on your arrow key, we can see what might have gone wrong. So I’m going to jump back to the window here, it’s always important to double check, it’s not going to damage anything if you don’t spell something correctly but it’s obviously not going to work so I spelt the word do incorrectly. So I jump up to ‘do’ and change that so it’s spelt correctly and now it starts running. Hear that fan drop, that is because the CPU is consuming more as it’s under a heavier workload which means there’s less power being distributed to the GPIO pins because the power there is sagging a little bit. So you can see we’ve gone from 37.4 to 54 degrees in 10 seconds - crazy town! But now the temperature as it did before is starting to plateau out and it should run pretty well so I’ll run for for a little bit more. I’ve actually I’ve already run cpuburn with this configuration and there’s no overclock settings at all it runs pretty well - it passes the cpuburn test which means after 10 minutes it’s stable, it doesn’t over heat, everything runs fine. So run that for 10 minutes and see how you go. That is all there is to stress testing, the process is simply, input your cooling, try the overclock settings, test it out and if it’s stable continue on, rinse and repeat. If not, change something and try again. That’s all there is to it guys - we just looked at downloading the software packages and running those packages to stress test the Raspberry Pi Make sure your Pi is cool and safe and loved before you move on to Overclocking and stay tuned for that next part, the finale in this mini series where we really dive into the Raspberry Pi and look at modifying how the system runs, its very cool and I’ll see you then, have a great day guys :-)