Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a way to point a browser in a container at a given url #2

Open
mrchrisadams opened this issue Jan 16, 2020 · 2 comments
Open

Add a way to point a browser in a container at a given url #2

mrchrisadams opened this issue Jan 16, 2020 · 2 comments

Comments

@mrchrisadams
Copy link
Member

mrchrisadams commented Jan 16, 2020

We want to simulate a user loading a page, and seeing how doing this affects the energy used by the system.

We currently think we'll do this using some system that relis on RAPL measurements

Something like this:

https://01.org/rapl-power-meter

But likely a python take on it, that already reflects some thought gone into it, like perhaps this one:

https://github.com/responsibleproblemsolving/energy-usage

Or possibly this one:

https://github.com/powerapi-ng/rapl-formula

It might be worth giving this a spin too:
https://powerapi-ng.github.io/howto_monitor_docker/intro.html

The dream

The eventual goal would be to run these headless, and integrate it into something like sitespeed.io

safari-stats

Blink based browsers have this:
https://docs.microsoft.com/en-us/microsoft-edge/devtools-guide-chromium/evaluate-performance/
https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/index

Firefox has this, built in by default which tracks performance here, with a focus on frame rates, and memory allocation in javascript.

https://developer.mozilla.org/en-US/docs/Tools/Performance

There is also a much more extensive profiler - this focuses mainly on how Firefox itself allocates memory.
https://profiler.firefox.com/

@mrchrisadams
Copy link
Member Author

mrchrisadams commented Jan 16, 2020

Okay, after further reading, this seems to be the difference between the two.

Both rely on RAPL measurements.

Energy usage

takes measurements every 0.1 seconds of energy used in joules1 over the length of the work, then eventually adds these together, along with the rest of the report for a page.

This gives us a single number, but doesn't highlight hotspots or give any indication where energy usage spikes, or provide the stats that Safari does.

Power API

Power API is quite a bit more complex, and measure more than just power usage. There are two bits you need at a minimum. A sensor that reads RAPL related stats, and stores them somewhere. The common example is the hwpc-sensor, a C binary.

These stats are then read by the formula, which converts these numbers into something more meaningful, like the power usage we might care about.

This is designed to make it possible to track energy usage across multiple containers. This relies on a more complex smartwatts-formula that takes care of allocating energy use to each one.

imag

Instructions for compiling the C binary are on the PowerAPI website
https://powerapi-ng.github.io/hwpc.html#specify-power-consumption-monitoring

Background for Power API

The following papers outline the architecture, and provide useful context, as the documentation isn't that clear.
https://ercim-news.ercim.eu/en92/special/powerapi-a-software-library-to-monitor-the-energy-consumed-at-the-process-level

https://hal.inria.fr/hal-01130030

This approach appears to be aimed at cloud infrastructure to make energy use visible with swarms of docker containers, to make better use of the infrastructure.
https://hal.inria.fr/hal-01403486

1 for quick functions, it checks every 0.01 seconds instead.

@mrchrisadams
Copy link
Member Author

mrchrisadams commented Jan 16, 2020

Okay, further info. you can compile the binary, without any of the MONGODB guff, and just log to csv.

The -c defines what kinds of events to listen for. The -e flag in the case below tells hwpc-sensor which events to listen for.

You need to define the kind of event with -c before listing the events themselves with e.

  • RAPL_ENERGY_PKG : whole CPU socket power consumption
  • RAPL_ENERGY_DRAM :RAM power consumption
  • RAPL_ENERGY_GPU : CPU integrated graphics processing unit

The -r and -U defines the output for the logging, and the URI to send it to.

So the final call might be:

hwpc-sensor \
  --name example-sensor \
  -c rapl
  -e RAPL_ENERGY_PKG \
  -e RAPL_ENERGY_DRAM \
  -e RAPL_ENERGY_GPU

  -r csv \
  -U /tmp/sensor_output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant