Make JoularJX work in VM
Currently, JoularJX only works on host systems directly, as it requires access to RAPL on PC/servers. RAPL is read through powercap that is only available on hosts and not in guest OS in virtual machines.
Proposed solutions:
- Develop a communication between guest-host to calculate the energy consumption of the VM and send this data to the guest.
- Or integrate the approach already deployed by Scaphandre or PowerAPI for this communication guest-host.
Idea:
- Measure VM power consumption in real time and write power to a file
- This file is shared or can be read from inside the guest OS, and which will be considered as the system energy consumption
Some docs for Qemu/KVM. Similar approach can be made for VirtualBox and VMware as explained in the user guide.
Hi, any updates to this track ? Most apps today run on VMs or k8s hence this bridge will be an important one. Happy to contribute if there some work related to this.
Thanks @pangteckchun for suggesting to help. We haven't worked much on it due to lack of time now. If you're willing to contribute, it'll be with pleasure.
The main idea I have to implement VM measuring is:
- Add 2 options (in config.properties), one boolean to set if we're in VM or not, and one string with the path in the guest OS of the energy file to read.
- The energy file will be considered as the energy of the entire guest VM, so we only need to add a new implementation of the CPU interface for VM (reading that file or files, and provide currentPower).
- The user will have to share that file between host/guest. The file is essentially a file in the host being shared with the guest.
- The file in the host will provide energy of the VM measured in the host OS. This can be done through many tools (Scaphandre, PowerAPI, our own PowerJoular, etc.)
So for JoularJX itself, the works is mainly adding a new implementation for the CPU interface and a couple of properties. Then mostly, testing it in a VM environment (virtualbox or vmware locally for instance), and make sure that the format/value of power monitoring in the host is well understood by JoularJX (scaphandre and powerjoular might provide different output or granularity).
Support for monitoring inside virtual machines has been merged into our other tool PowerJoular with this pull request. We should be able now to integrate it into JoularJX quite easily as the approach is implemented and tested there.