High processing power comes with high power consumption. I guess that can’t be helped much but one way to reduce the power bill for that number-crunching ‘headless’ workstation under the desk without screen and keyboard is to suspend it at night and at times during the day when it is not needed. As long as it can be done from my notebook and as long as it’s as easy as pressing the COMMAND+L key that locks the screen of my notebook and puts the display on the desk into power save mode, that should not be too hard to do in practice.
So let’s compare some numbers: When my notebook is running and the built-in screen is on, it consumes around 10 watts while few things are going on. My HP Z440 workstation on the other hand has an idle power consumption of 45 watts even if no display is connected at all. When running processing intensive tasks on the CPU and GPU simultaneously (e.g. Handbrake H.264 encoding as described in a previous post), power consumption increases to around 100 to 130 watts. That’s fine by me as the rig does something for the power spent. The 45 watts in idle state, however, are not so nice. If run 24/7, the workstation would consume 45 watts * 24 hours * 30 days = 32 kWh per month. At 26 euro cents per kWh, that’s €8.32 on the monthly power tab or 100 euros extra a year.
This can of course be significantly reduced if the workstation can be suspended and quickly resumed when needed. Suspending the workstation is straight forward on the command line. ‘sudo systemctl suspend’ suspends the remote system and power consumption for keeping the RAM refreshed is around 2 watts. For waking up the workstation without crawling under the desk, Wake-on-LAN (WoL) is your friend! The shell command ‘wakeonlan MAC-address’ does the job after the functionality is activated in the workstation’s BIOS.
Suspending and resuming the workstation on the command line is nice but it’s still too much of a hassle, it takes too much time. The fix: I put the two commands on keyboard shortcuts! For quick reach, I put the suspend command next to the ‘L’ key so I can conveniently execute the command at the same time I also press the ‘L’-ock key for the screen of my notebook. In order not to mix up suspend and resume, I put the resume command on a key at the other side of the keyboard.
While the wakeonlan command can be run via a keyboard shortcut as it is, the systemctl suspend command needs to be run over ssh and with root permissions. So the hotkey command for suspend looks as follows:
ssh root@z440 'systemctl suspend'
This way, no root password has to be typed in, the ssh key takes care of authentication!