acsicuib / YAFS

Yet Another Fog Simulator (YAFS)
MIT License
98 stars 72 forks source link

Service migration follows the movement of users #27

Closed jiaweiwangwang closed 4 years ago

jiaweiwangwang commented 4 years ago

Hello, During this time I have been doing service migration following the user's movement. But I didn't realize my idea that service migration with the user's movement on YAFS . I know if you can guide me to implement my experiment.

wisaaco commented 4 years ago

Hello, Maybe, the example "DynamicWorload" is a good starting point for you. In this scenario, the users change their localisation in different nodes along with the execution. The movement is generated calling a specific function defined in main.py (line 117):

pop = Population_Move(name="mttf-nodes",srcs = number_generators,node_dst=main_fog_device,activation_dist=dStart)

In Population_move, the function run implements the movement, you can manipulate the code like in that project or you can use specific functions of yafs.

 sim.alloc_DES[ID] =  next_src_position  #new localisation
or 
 idsrc = sim.deploy_source(app_name, id_node=idtopo, msg=msg, distribution=dDistribution) #new user
...

The movement of services is similar. You define a class that interrupts the simulation. And this class runs specific code. In the following code, we create/deploy a new service in a node (idtopo)

        app_name = service[0:service.index("_")]
        app = sim.apps[app_name]
        services = app.services
        idDES = sim.deploy_module(app_name, service, services[service], [idtopo])