18

I have cloud storage data centers running Ubuntu 16.04 LTS and NextCloud/OwnCloud that have no need to be available 24/7 and need power management solutions. Servers are Dell PowerEdge 1950 Gen II and Dell PowerEdge 2950 Gen II

Overall Objective

Hibernate cloud storage servers past an idle time for example 20 minutes and have such de-hibernated with WOL to reduce 6272.09 kilos of carbon dioxide per year being 6680kw from our data center alone, metrics achieved throughout a detailed energy audit.

Ineffective solution tried

Landscape

The landscape on-premises/cron jobs only offer scheduled startup and shutdowns, thereby ineffective for our achievable.

Powernap

powernap seems the way to go but the service is not starting on Ubuntu 16.04

XXXXXXX~$ sudo service powernap status
● powernap.service - PowerNap
   Loaded: loaded (/lib/systemd/system/powernap.service; disabled; vendor preset
   Active: inactive (dead)

powernap seems to use depreciated services such as network.service which are no longer available in Ubuntu 16.04

Achievable objectives

Wake on LAN (WOL)

Enabling WOL is straightforward by following the manual setup on this link. or with the use of power wake

Server Hibernation

Until now, I have only managed to hibernate the servers using sudo systemctl hibernate and sudo systemctl hibernate-sleep

  1. powernap - I am filing bug reports to remove depleted dependencies
  2. systemctl - could lead to somewhere
  3. pm-utils - could lead to somewhere too

Hardware Upgrades

I have upgraded the CPUs of the Dell 1950 Gen II dual Xeon E5335 with Xeon X5365 CPUs. The X5365 enable power management and set power management from BIOS. In all honesty, I was not in favor of such upgrade as the X5365 consume 70 watts per CPU more than E5335, but did such in favor of hibernation testing.

Update 1

At this moment in time pm-utils is the only way to go apart from setting wol on the nic. Currently, I am exploring the optimal configuration to create a powerful hook for ac settings for idle time.

Any recommendations, please.

Fab
  • 405

3 Answers3

0

To simply hibernate for Ubuntu <21 you can use the hibernate command (sudo apt install hibernate). Other things wont work. Stolen from somewhere: put resume=path-to-your-swap into GRUB_CMDLINE_DEFAULT

I tested this using an apple laptop. It works fine. Using the UUID wont work - somehow changes sometimes

france1
  • 174
0

When you hibernate an instance, Amazon EC2 signals the operating system to perform hibernation (suspend-to-disk). Hibernation saves the contents from the instance memory (RAM) to your Amazon Elastic Block Store (Amazon EBS) root volume.

0

I put together a little script which you could run in a cronjob every 15 minutes or using systemd timers:

#/bin/bash

NActiveUsers=$(who -q | awk -F'#' '{printf $2}' | awk -F'=' '{printf $2}')
AvgLoad15Min=$(cat /proc/loadavg | awk -F' ' '{print $3}')

ActiveUsersThresh=2
AvgLoadThresh=0.15

if [ "$NActiveUsers" -lt "$ActiveUsersThresh" ]
then
    LoadBelowThresh=$(echo $AvgLoad15Min'<'$AvgLoadThresh | bc -l)
    if [ "$LoadBelowThresh" -eq 1 ]
    then
        systemctl hibernate
    fi
fi

It first gets the number of users which are logged in to the system and the average load during the last 15 minutes. You should be able to find out your idle average system load using cat /proc/loadavg. The third floating point numbers gives the average over the last 15 minutes. This value is helpful to define a threshold set in the variable AvgLoadThresh. This certainly will need tuning. The other thing that you can define is how much users are allowed to be logged in and the system goes to hibernate anyhow. This is set in ActiveUsersThresh. Just to make sure the system is not always hibernating when you are doing maintenance or something.

I guess one could come up with more intelligent checks, so see it as a first simple-minded approach. For example, i don't know which database or webserver is used in your owncloud installation but you could try to stop them gracefully before the hibernate command, so nobody would suddenly loose connection.

derHugo
  • 3,376
  • 5
  • 34
  • 52
romed
  • 151