Skip to content

AminAvan/RL_in_EdgeSimPy

Repository files navigation


Overview

The original repository of EdgeSimPy can be found here. We have added features to the original source code, developing it into a framework for testing and experimenting with scheduling algorithms for real-time applications in edge computing.

MDP size with and without pruning

Edge Computing Conventional MDP Graph Pruned MDP Graph Graph Size
Tasks Servers Vertices Edges Vertices Edges Reduction
4 2 28=256 32640≈214 35≈25 34≈25 ≈99%
8 2 216 ≈231 ≈29 ≈29 ≈99%
16 2 232 ≈263 ≈217 ≈217 ≈99%
32 2 264 ≈2127 ≈233 ≈233 ≈99%
64 2 2128 ≈2255 ≈265 ≈265 ≈99%
128 2 2256 ≈2511 ≈2129 ≈2129 ≈99%
256 2 2512 ≈21023 ≈2257 ≈2257 ≈99%
512 2 21024 ≈22047 ≈2513 ≈2513 ≈99%
1024 2 22048 ≈24095 ≈21025 ≈21025 ≈99%

Graph size is defined as |V|+|E|. Size reduction is calculated by comparing the conventional and pruned MDPs.

Network Topology

Network Topology

Fig: Network topology of the Edge Computing (EC) environment. The EC infrastructure comprises 22 BSs, each covering a distinct area and equipped with a network switch for wired connectivity. Red circles represent BSs hosting edge-servers.

Characterization of Edge-users' Offloaded Tasks

Service Processor* RAM (MB) Storage (MB)
Nginx 3,500 60 187.8
Alpine Linux 5,500 60 7.8
Redis 15×10³ 60 116.92
Aerospike 20×10³ 250 210.9
Ubuntu 25×10³ 350 78.1
Envoy 25×10³ 150 205
Apache Kafka 25×10³ 350 650
Python 30×10³ 60 1,020.1
MobileNetSSD 90×10³ 450 1,473.5
YOLOv8 25×10⁴ 800 14,171.45
PyTorch 3×10⁶ 1,024 7,603.9
TensorFlow 33×10⁶ 1,024 1,857.6

* Required processor cycles for 1 MB of the service's workload per second.

P. S. Souza, T. Ferreto, and R. N. Calheiros, “Edgesimpy: Python- based modeling and simulation of edge computing resource management policies,” Future Generation Computer Systems, vol. 148, pp. 446–459, 2023.

Characterization of Edge-servers

Name Clock Frequency (GHz) Number of Cores RAM (GB) Storage (GB)
NVIDIA Jetson TX2 1.479 4 8 32
Intel E5430 2.66 8 16 131
Intel E5645 2.4 12 16 131

P. S. Souza, T. Ferreto, and R. N. Calheiros, "Edgesimpy: Python-based modeling and simulation of edge computing resource management policies," Future Generation Computer Systems, vol. 148, pp. 446–459, 2023.

Required Packages

All packages required by EdgeSimPy are listed in the pyproject.toml file, which should be installed using Poetry in Python.

Build Instructions

Assuming you have already installed a recent version of Poetry (how to install) and your Python version is 3.10.x, you can install the required packages for EdgeSimPy using the following command:

poetry install
poetry shell

After completing the above step, you need to change the 'Python Interpreter' in your IDE to point to the 'Poetry Environment' location. The path was output by poetry shell, and you need to append \Scripts\python.exe to the end, resulting in a path like [output from poetry shell]\Scripts\python.exe.

Selecting & Running Scheduling Algorithms

In the main file, the algorithm_functions function poses all available scheduling algorithms. Set your preferred algorithm name as the value of the scheduling_algorithm variable, located just after this function.

After selecting your preferred scheduling algorithm, run main. While the file is running, the following information will be printed regularly as an online report of the scheduling process until completion.

'...' out of '...' services are successfully scheduled.
runtime: '...' seconds
memory consumption: '...' MB until '...' seconds
power consumption: '...' Watt-seconds until '...' seconds
  • runtime: the time it takes for the algorithm to generate an optimal/near-optimal schedule for '...' out of '...' services based on service attributes & edge server resources, plus the time required to provision these services according to the schedule.
  • memory consumption: the memory used by the algorithm during scheduling & provisioning for '...' out of '...' services.
  • power consumption: the power consumed by the algorithm during scheduling & provisioning for '...' out of '...' services.

Upon completion of the scheduling process, the following information will be displayed:

Total runtime: '...' seconds
Total memory consumption: '...' MB
Total power consumption: '...' Watt-seconds

Dataset

We modify & introduce new parameters in the dataset generator to generate a dataset incorporating real-time parameters specific to the services within edge user applications.

This dataset simulates a video surveillance scenario with four applications:

  1. Crowd counting 2) services: alpine, python, nginx, redis, mobilenetssd.
  2. Face recognition 3) services: ubuntu, python, envoy, aerospike, yolov8.
  3. Machine learning model development for crowd counting 4) services: ubuntu, python, envoy, kafka, pytorch, mobilenetssd.
  4. Machine learning model development for face recognition 5) services: ubuntu, python, envoy, kafka, tensorflow, yolov8.

The data from container_images defines the required disk space and container image layers, which are utilized during the provisioning process as part of the algorithm's runtime.

In dataset, all services are characterized by a list of dictionaries named service_demand_values, which each dic includes the following information:

  • "label": name of service
  • "cpu": we set this variable to 1 for all services, as it was previously used to indicate CPU demand in terms of the number of cores. However, we now determine the CPU demand of a service based on the processor cycles needed per second for processing 1MB of its data.
  • "memory: y": amount of memory (RAM) required by a service to operate.
  • "cpu_cycles_demand": (x * y)": The total required processor cycles are calculated by multiplying x (the cycles needed per second to process 1MB of data) by y.

The distribution of application types & their respective services in dataset is detailed below. Each time a dataset is generated using dataset generator, the following information will be printed:

==== INFRASTRUCTURE OCCUPATION OVERVIEW ====
Edge Servers: 4
	Total CPU computational capacity: 61912000000.0 Hz
	Total RAM capacity: 49152 MB

Edge users: 52
	crowd counting [Critical Sensitivity]: 44 (84.62%)
	face recognition [High Sensitivity]: 6 (11.54%)
	crowd counting ml dev [Moderate Sensitivity]: 1 (1.92%)
	face recognition ml dev [Low Sensitivity]: 1 (1.92%)

Services of 52 edge users: 262
	Total CPU Cycles Demands: 9670960000
		[Critical Sensitivity]: 1924560000 (19.9%)
		[High Sensitivity]: 1315800000 (13.61%)
		[Moderate Sensitivity]: 3135550000 (32.42%)
		[Low Sensitivity]: 3295050000 (34.07%)
	Total RAM Demand: 45138 MB
		[Critical Sensitivity]: 30360 (67.26%)
		[High Sensitivity]: 9660 (21.4%)
		[Moderate Sensitivity]: 2384 (5.28%)
		[Low Sensitivity]: 2734 (6.06%)

Monitoring

We can monitor the entity's state at the end of each time step of EdgeSimPy using monitoring. Simulation logs are stored in MessagePack, and you can customize which entity metrics are monitored at each time step by overriding the entity's collect() method.

Based on the current monitoring code, various details about each edge server can be obtained, including its coordinates, its availability, RAM capacity, disk capacity, processor demand (based on cycles demand), memory demand, storage demand, and the IDs of services hosted on the server.

In addition, the current monitoring provides details about each service, including its ID, availability status, associated application ID, the ID of the hosting edge-server, and migration status.

Finally, the current monitoring prints 'm' out of 'M' services are experienced failures (missed/lost/failed), potentially affecting 'n' of the 'N' users.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages