acsicuib / YAFS

Yet Another Fog Simulator (YAFS)
MIT License
101 stars 73 forks source link

Dynamic Allocation of service #36

Closed anuj1501 closed 2 years ago

anuj1501 commented 3 years ago

I am trying to simulate a dynamic service placement algorithm, where the service placed would be decided based on the availability of network and CPU resources. What is the best way of doing this? Should I inherit the original ServicePlacement class given, or is there a more standardized technique?

anuj1501 commented 3 years ago

@wisaaco @jamesn1197

wisaaco commented 3 years ago

Take a lookout at this project: https://github.com/acsicuib/MARIO/tree/MarioII It has similar behaviour to your idea. You can use the folder structure to set up your project. The master branch contains the original prototype with a brief description.

anuj1501 commented 3 years ago

@wisaaco I had one more doubt. If I want to use machine learning model prediction as a service such that I can dynamically assign edge node's resources when I send some data for prediction from a sensor , instead of a message in the simulator, Like I can send data in image format, to an object detection service , which will then dynamically compute the resources it will require to make the prediction and send it in low latency time, so can you suggest me what all changes should I make in the code to make this work?

anuj1501 commented 3 years ago

@wisaaco @jamesn1197

andremtsilva commented 3 years ago

Hi @wisaaco,

Is there an example of using a placement algorithm with the yafs.placement interface?

wisaaco commented 3 years ago

Hello, That part was designed to be similar to iFogSim, but it is totally unnecessary when you work with graphs. I mean, the identification of nodes in a graph depends on you or some external data (real coordinates, localization, ...). So, you tag the nodes as your need, and hence you control in some part of the code the allocation.

For example, the initial deployment de services In nodes is done by the following "classic" lines, in: https://github.com/acsicuib/YAFS/blob/YAFS3/src/tutorial_scenarios/serviceMovement/main.py (lines 136 and 152)

placementJson = json.load(open(experiment_path + 'allocDefinition.json'))
placement = JSONPlacement(name="Placement", json=placementJson)
# followed by the dataPopulation choices

And, in your custom process you choice the nodes where create or move the service instance. Example in: https://github.com/acsicuib/YAFS/blob/YAFS3/src/tutorial_scenarios/serviceMovement/main.py (line 177). Of course, these lines require to understand some internal variables of YAFS but the flexibility is better.

In addition, in line 117 you have an example to add more data/attributes in your topology elements. And you can use them to have more control with your allocation policy.

andremtsilva commented 3 years ago

Hi @wisaaco,

I'm trying to adapt the https://github.com/acsicuib/YAFS/tree/YAFS3/src/examples/DynamicAllocation to the new API and I can't figure out a way to make the Evolutive class to become the CustomStrategy class.

My main problem is with the deploy_app method that takes the population argument in the old API.

Can you please point me any direction to adapt this cenario?

Thanks in advance.