scaphandre icon indicating copy to clipboard operation
scaphandre copied to clipboard

Detect and store Idle, 50% and Max CPU+RAM Usage result on power consumption, when it happens

Open bpetit opened this issue 2 years ago • 3 comments

Problem

As someone keen to provide open data on power consumption depending on hardware, I'd like to have an opportunistic approach to know the power profile of my machine, then store it in a database.

Solution

Add a flag to ask Scaphandre to detect when CPU+ Ram resources is at its lowest possible (once system is booted), then store the power consumption in memory, do the same when at ~50% of resources consumed, and 100%, then send this metric to the targeted TSDB when the 3 (or more) elements of the dataset are present.

Alternatives

Provide a way to extract this data even if incomplete, right away (eg. only containing idle and 50% records).

Additional context

This could help to improve the data for the soon-to-be-released api from https://github.com/Boavizta/ and more broadly be useful to help open data on energy consumption of IT infrastructures.

bpetit avatar Apr 13 '22 14:04 bpetit

Hi,

This is interesting but I am not sure how to qualify lowest possible, particularly for CPU, nor how we could have a kind of reference scenario.

Would that mean proposing a "standard benchmark/test scenario" that could be achieved by launching a kind of stress test (ramping up from 0 load to saturating CPU cores) ?

I am thinking of something like stress-ng which seems quite configurable (with --cpu-load option).

What do you think ?

demeringo avatar Apr 19 '22 13:04 demeringo

I think lowest should be called idle.

Using top

top output

%Cpu(s): 19.4 us,  8.8 sy,  0.0 ni, 71.7 id,  0.0 wa,  0.0 hi,  0.1 si,  0.0 st
MiB Mem :   7710.9 total,    294.3 free,   3478.3 used,   3938.2 buff/cache
MiB Swap:   7711.0 total,   6635.4 free,   1075.6 used.   3216.0 avail Mem 

Workload % CPU = 100 - %Cpus(id) IDLE : Workload % CPU ≈ 0

Workload % Ram = ((MiB Mem(total) - MiB Mem(free))/MiB Mem(total))*100 IDLE : Workload % Ram ≈ 0

/!\ top step (top -d step) should be synchronized with scaphandre step.

Other strategies

Other commands can be considered see https://www.atlantic.net/vps-hosting/how-to-check-linux-cpu-usage-or-utilization/. For cpu : mpstat, sar, iostat, vmstat For ram: free, /proc/meminfo,vmstat

@demeringo I think Boavizta already planned to integrate stress test within its project. Since there is no need for "active" stress test, I think the idea would be to use the opportunity of having scaphandre installed on heterogeneous devices and environments to gather several electrical consumption profile for open science purposes.

@bpetit I wonder about the usefulness of an electrical consumption profile if we don't implement a way to merge it with his configuration (CPU info, ram info, environment, …).

da-ekchajzer avatar Apr 19 '22 19:04 da-ekchajzer

@da-ekchajzer Merging work from the Greenhack22 branch in dev, I should get to something okay about about IT resources consumption, which should make this feature more useful.

Related to #238

bpetit avatar Nov 11 '22 10:11 bpetit