Newer
Older
# Energy Metrics for Edge Microservice Request Placement Strategies
On this repository you can find the material presented in the following article:
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
Toczé, Klervie, and Simin Nadjm-Tehrani. "Energy Metrics for Edge Microservice Request Placement Strategies." Article accepted at ICPE25.
This repository contains three different types of files:
- `/Code`: the Java simulator files
- `/Results`: the results files which are presented in the paper, both the raw files and the processed ones
- `/Analysis`: the analysis scripts used on the results files to obtain the figures presented in the paper
## Running the simulator
Note: this work is using Gurobi as an optimization solver so you will need a Gurobi license for the simulation to run.
The simulator has been implemented and run on Windows.
### Installation
To install the Java simulator, follow these steps:
1. Download [Intellij IDEA](https://www.jetbrains.com/idea/).
2. Clone this repository to your machine.
3. Open the `/Code` folder as a new project in Intellij IDEA.
4. Install any missing JDK that Intellij IDEA requires by clicking on the button.
5. Verify that the .jars files from `/Code/jars` are added to the project. They should appear in `Project Structure/Project Settings/Modules`. If not, add them using the "+".
6. Install [Gurobi](https://support.gurobi.com/hc/en-us/articles/4534161999889-How-do-I-install-Gurobi-Optimizer) (Full installation) and [activate your license](https://support.gurobi.com/hc/en-us/articles/12872879801105-How-do-I-retrieve-and-set-up-a-Gurobi-license).
They offer free academic licenses. Make sure that the Gurobi jar in the `/Code/jars` folder corresponds to the one in your installation. If not, update the jar file in the folder to the one from your installation.
### Running
To run a simulation:
1. Update if necessary the `/Code/src/utils/Config.java` file with the wanted settings.
2. Update if necessary lines 23-29 in the `/Code/src/MixedReality_Optimization.java` file with the wanted parameters. These correspond to a run group and have to be modified to obtain another run group.
3. Right click on the `/Code/src/MixedReality_Optimization.java` file in the project tree and select "Run".
4. After the simulation has finished running, save the output log if you want to further analyze it.
To run the same epxeriments as in the paper, use the following parameter settings in `/Code/src/MixedReality_Optimization.java`.
| Run group type | Name |numberOfFunctionInstances | usingUniformLoadDistribution | standardDeviation | linksAreLoaded | oneCoreAllocation| randomStartLocation | colocationScenario |
| -------- | ------- |-------- | ------- |-------- | ------- |-------- | ------- |-------- |
| 1 | Initial study | 2 | false | 10 | true | true | false | false |
| 2 | Normally distributed load | 2 | false | 10 | false | true | false | false |
| 3 | Fixed load | 2 | true | N/A (any value is fine) | false |true | false | false|
| 4 | Larger standard deviation | 2 | false | 30 | false |true | false | false |
| 5 | 4 function instances | 4 | false | 10 | false | true |false | false |
| 6 | 6 function instances | 6 | false | 10 | false | true | false | false |
| 7 | Full co-location | 6 | false | 10 | false | true| false | true |
| 8 | Random beginning device - Normally distributed load | 2 | false | 10 |false | true | true | false |
| 9 | Random beginning device - Fixed load | 2 | true | N/A (any value is fine) | false |true | true | false |
| 10 | Random beginning device - Larger standard deviation | 2 | false | 30 | false |true | true | false |
| 11 | Random beginning device - 4 function instances | 4 | false | 10 | false | true | true | false |
| 12 | Random beginning device - 6 function instances | 6 | false | 10 | false | true | true | false |
Note: The `/Code/src/utils/Config.java` file contains a seed to enable the reproduction of the experiments. Based on what you are using the simulator for, you may want to change it or disable it.
The seed is used to generate the utilization levels as well as to choose the random request device if this parameter is set to true.
## Analysis
Note: the analysis requires that you have [Python](https://www.python.org/downloads/) and e.g. [RStudio](https://posit.co/download/rstudio-desktop/) installed.
The analysis of the output is performed in two phases:
1. The output log (a `.txt` file) is parsed using Python scripts to create `.csv` files containing the useful data for the graphs
2. The obtained `.csv` files are loaded into a R script which takes care of rendering the curves
The `/Analysis` folder contains two Python scripts and one R script.
- `Analysis/resultLogParsing.py` extracts information about energy consumption (Overall and Marginal) and completion time for all placements contained in the log.
- `Analysis/resultLogParsing_UtilizationDifferent.py` extracts information about the utilization levels of the devices used in the placement solution, but only for the cases where the marginal and overall objectives lead to different placements.
- `Analysis/evaluationCurvesAndAnalysis.R` contains the code used for drawing the figures and extracting some statistics presented in the paper.
To run the Python script:
1. Make sure to update the files names in the script files. This is done in two places: (1) on line 5, input the name of the resulting `.csv` file, and (2) on line 14 or 17, input the name of the input log file.
2. Execute the script.
To run the R script:
1. Install the ggplot2 package and any other packages necessary (Rstudio should prompt you with the ones that are necessary).
2. Run the two first lines to load ggplot2 and set the working directory to the `/Results` folder, e.g. using the "Run" button.
3. Select the code block corresponding to the curve or analysis you want. Each code block between `####Begin` and `####End` is runnable independently.
4. Make sure that the file name(s) is/are the correct one(s).
5. Run the selected lines, e.g. using the "Run" button.
##Results
The `/Results` folder has one subfolder per run group type.
In each subfolder, you can find:
- A `.txt` file: this is the raw output log
- One or several `.csv` files: these are the output of the parsing step. The name of the file indicates which parsing script was applied.
- One or several `.pdf` files: these are the figures, drawn using the R script.
There is an additional folder for the energy model figure.
The files are named in a systematic way, with files corresponding to the same run group having the same name possibly with a prefix and/or suffix.
## Previous versions
A previous version of this work is presented in the following article:
Toczé, Klervie, and Simin Nadjm-Tehrani. "Energy-aware Distributed Microservice Request Placement at the Edge." arXiv preprint [arXiv:2408.13748](https://arxiv.org/abs/2408.13748) (2024).
The commit corresponding to this work is 863013c1ff59d7cccfe9eb33d70210efd44ebb56.
Klervie Toczé (k.m.tocze@vu.nl)