Whee! I Finally Pegged My CPUs

I know this may be one of the goofiest posts in a while, but I just had an experience that left me wide-eyed.

I use Webmin as my server management tool. It's often the most resource-hungry program running on my computer (xrdp runs a close second) but since I have 2 x Intel(R) Xeon(R) CPU X5670 @ 2.93GHz, 24 cores I don't usually see much CPU utilization. Until today.

I recently decided (on the recommendation of some posters here) to migrate my media server from Plex to Jellyfin. At the time, I decided my directory and file structure could stand a little better organization, so I started moving scads of folders around, moving files from one place to another, disabled journaling on an HFS+ disk, and all the while kept Plex running while I set up Jellyfin.

Holy tachometer, Batman! I saw the CPU usage in Webmin running in the 75%-85% range, and at one time it spiked into the 90s, even touching 99% at one time! Rather than be alarmed (well, I was mildly astounded) I thought to myself, "Finally! All that CPU power is finally being put to use!" I even heard the server's fans kick in--now that's some CPU workload going on there!

It didn't last long (and I think it speaks well of Jellyfin to update its metadata as things change!). But it was fun while it lasted!

5 Likes

So cool !! :smiling_face:

If you want to relive that moment, this script will torture your cores for you :innocent:

#!/bin/bash

# Choose your processmonitor
monitor=htop

# processmonitor fallback
which $monitor &>/dev/null || monitor=top

# stderr output gets in the way, mute it.
exec 2> /dev/null

# Empty screen and start processmonitor
clear
echo -e "\nstarting $monitor"
xterm -e $monitor & monitor_pid="$!"

# Get number of cores
read _ _ cores < <( grep "siblings" /proc/cpuinfo )
echo -e "\ntesting all $cores cores\n"

# The CPU-burn function
Burning() { while : ; do : ; done ; }

# Starting
for (( x=1 ; x <= cores ; ++x ))
do
	Burning & cpid[x]="$!"
	echo "coreburner $x active, pid=${cpid[x]}"
	sleep 0.5
done

# Waiting
echo -e "\nhit a key to stop burntest...\n" ; read -s -n1 ; read -t0.1

# Stopping
for (( x=1 ; x <= cores ; ++x ))
do
	kill -9 "${cpid[x]}" && echo "coreburner $x killed, pid=${cpid[x]}"
	sleep 0.5
done

# Monitoring off
sleep 5 ; kill -9 "$monitor_pid" && echo "$monitor killed"
1 Like

That's what I love about Linux geeks: Always finding creative ways to be useless! :joy:

2 Likes

there is Prime95 and stress-ng, they will peg the cores to 100%.

2 Likes

Yeah, but just maxxing out CPU without doing anything is like spinning one's wheels. It burns a lot of rubber but doesn't get you anywhere.

2 Likes

Do all of your systems have sufficient cooling to avoid hitting the Thermal Ceiling that pops the core panic shutdown?

Regrettably, my old system does not! :frowning:

(And I already added 2 fans blowing air into the chassis at the built-in vents!)

1 Like

Early on after I built my server, I had an issue with temperature and fan control. I installed a utility, [ipmitool](How to Install IPMItool on Ubuntu & Rocky Linux) and built a few scripts trying to get the monitoring and fan activation I wanted. I now have a cron job that runs a check every five minutes, and activates the fans if the temperature threshold is reached

#!/bin/bash

# ----------------------------------------------------------------------------------
# Script for checking the temperature reported by the ambient temperature sensor,
# and if deemed too high send the raw IPMI command to enable dynamic fan control.
#
# Requires:
# ipmitool – apt-get install ipmitool
# slacktee.sh – https://github.com/course-hero/slacktee
# ----------------------------------------------------------------------------------


# IPMI SETTINGS:
# Modify to suit your needs.
# DEFAULT IP: 192.168.0.120
IPMIHOST=192.168.1.199
IPMIUSER=root
IPMIPW=xxxxxx
IPMIEK=0000000000000000000000000000000000000000

# TEMPERATURE
# Change this to the temperature in celcius you are comfortable with.
# If the temperature goes above the set degrees it will send raw IPMI command to enable dynamic fan control
# MAXTEMP=27
MAXTEMP=31

# This variable sends a IPMI command to get the temperature, and outputs it as two digits.
# Do not edit unless you know what you do.
# TEMP=$(ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK sdr type temperature |grep Ambient |grep degrees |grep -Po '\d{2}' | tail -1)

TEMP=$(ipmitool sdr type temperature | grep Ambient | grep degrees | grep -Po '\d{2}' | tail -1)

if [[ $TEMP > $MAXTEMP ]];
  then
    printf "Warning: Temperature is too high! Activating dynamic fan control! ($TEMP C)" | systemd-cat -t R710-IPMI-TEMP
    # echo "Warning: Temperature is too high! Activating dynamic fan control! ($TEMP C)" | /usr/bin/slacktee.sh -t "R710-IPMI-TEMP [$(hostname)]"
    # ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK raw 0x30 0x30 0x01 0x01
	ipmitool raw 0x30 0x30 0x01 0x01
	touch /tmp/temptoken
  else
    # healthchecks.io
    # curl -fsS --retry 3 https://hchk.io/XXX >/dev/null 2>&1
    printf "Temperature is OK ($TEMP C)" | systemd-cat -t R710-IPMI-TEMP
    # echo "Temperature is OK ($TEMP C)"
    if [ -f /tmp/temptoken ]; then
	/usr/local/bin/R710-IPMIStatic.sh
	rm /tmp/temptoken
    fi
fi
2 Likes