Skip to content

RayCloudSim: A Simulator Written in Python for Cloud, Fog, or Edge Computing

License

Notifications You must be signed in to change notification settings

ZhangRui111/RayCloudSim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

92 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RayCloudSim: A Simulation Platform Written in Python for Cloud/Fog/Edge Computing

Update Summary

  • 2024/07/02

    • [New] Adding support for the Topo4MEC dataset
  • 2024/04/26

    • [New] Users can now easily create the Scenario using configuration files in JSON format
    • [Optimization] The dataset has been optimized for saving in CSV format, offering better readability
    • [New/Optimization] More and better visualization tools, including simulation processes reproduced in video format, facilitate an intuitive understanding of the simulation process
  • 2024/04/14

    The first official release v1.0.0 has been published on the main branch, with the following major updates:

    • [New] Removal of the "Computational Unit" (CU); adoption of a computational resource modeling approach based on "CPU frequency, number of CPU cycles"
    • [New] Simulation process now supports modeling of computational energy consumption
    • [New] Computational tasks now support the feature of timeout failure
    • [Optimization] Optimization of the task queue
    • [Optimization] README documentation updated
    • [Optimization] examples/* Example programs updated
    • [Fix] Fixed some bugs
      • Module import failures caused by file paths

Important Notice for Previous Users: The versions prior to v1.0.0 have been preserved on the pre-v0.6.6 branch, but no further updates are expected for this version. We are very grateful for the support of all users for the early versions!

Star History Chart

I. Introduction

RayCloudSim is a lightweight simulator written in Python for analytical modeling and simulation of Cloud/Fog/Edge Computing infrastructures and services. The original intention for the development of RayCloudSim was for research related to task offloading, and it now supports a more diverse range of research topics.

RayCloudSim has the following advantages:

  • Compact source code, which is easy to read, understand and customize according to individual needs.
  • It is a process-based discrete-event simulation framework and can be performed "as fast as possible", in wall clock time.
  • It is easy to integrate with machine learning frameworks such as PyTorch, TensorFlow, and other Python-based ML frameworks.

RayCloudSim can be used for the following research topics:

  • Research on task offloading in cloud/fog/edge computing
  • Research on performance and cost analysis of cloud/fog/edge computing
  • Research on traffic analysis of complex networks
  • Research on resource management and scheduling strategies for large-scale distributed systems
  • Research on deployment strategies for specific devices, such as parameter servers in federated learning
  • ...

II. Requirements & Installation

Main Dependent Modules:

  • python >= 3.8: Previous versions might be OK but without testing.
  • networkx: NetworkX is a Python package for the creation, manipulation, and study of the structure, dynamics, and functions of complex networks.
  • simpy: SimPy is a process-based discrete-event simulation framework based on standard Python.
  • numpy: NumPy is a Python library used for working with arrays.
  • pandas: Pandas is a fast, powerful, flexible and easy to use open source data analysis and manipulation tool.

The following modules are used for visualization tools:

  • matplotlib
  • cv2
  • tensorboard

Users are recommended to use the Anaconda to configure the RayCloudSim:

conda create --name raycloudsim python=3.8
conda activate raycloudsim
pip install -r requirements.txt

III. Set Sail

3.1 Hello World

# Create the Env
scenario=Scenario(config_file="examples/scenarios/configs/config_1.json")
env = Env(scenario, config_file="core/configs/env_config.json")

# Begin Simulation
task = Task(task_id=0,
            task_size=20,
            cycles_per_bit=10,
            trans_bit_rate=20,
            src_name='n0')

env.process(task=task, dst_name='n1')

env.run(until=20)

print("\n-----------------------------------------------")
print("Energy consumption during simulation:\n")
print(f"n0: {env.node_energy('n0'):.3f}")
print(f"n1: {env.node_energy('n1'):.3f}")
print(f"Averaged: {env.avg_node_energy():.3f}")
print("-----------------------------------------------\n")

env.close()

Simulation log:

[0.00]: Task {0} generated in Node {n0}
[0.00]: Task {0}: {n0} --> {n1}
[1.00]: Task {0} arrived Node {n1} with {1.00}s
[1.00]: Processing Task {0} in {n1}
[11.00]: Task {0} accomplished in Node {n1} with {10.00}s

-----------------------------------------------
Energy consumption during simulation:

n0: 0.000
n1: 0.072
Averaged: 0.036
-----------------------------------------------

[20.00]: Simulation completed!

3.2 Tutorials

3.2.1 The following figure presents the framework of RayCloudSim, which consists of two main components:Env and Task:

The framework of RayCloudSim

3.2.2 A Simple Introduction to System Modeling: docs/RayCloudSim.md

3.2.3 The following scripts can be used as progressive tutorials.

Note that learning how to use Simpy would be very helpful.

3.2.4 RayCloudSim supports multiple visualization features: static visualization of system topology, dynamic visualization of the simulation process, etc.

  • static visualization of system topology
  • dynamic visualization of the simulation process

The complete video:

IV. Development Plan

4.1 TODO

For subsequent updates, please refer to the update summary

  • The basic version. (2023/05/10)
  • Added modules zoo, including WirelessNode, etc. (2023/10/24)
  • Computational nodes now support queue space to facilitate task buffering. (2023/11/10)
  • Modeling of 'computational energy consumption' and 'task timeout' supported, etc. (2024/04/14)
  • Metric/* (2024/04/16)
  • Evaluation APIs (2024/04/16)
  • Anything reasonable

4.2 Contribute Code to RayCloudSim

We welcome any contributions to the codebase. However, please note that the main branch is protected, and we recommend that you submit/push your code to the dev-open branch.

More

About

RayCloudSim: A Simulator Written in Python for Cloud, Fog, or Edge Computing

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages