# Simulating Fog and Edge Computing Scenarios: An Overview and Research Challenges
## 2 Fog and Edge Computing: Modelling and Simulation Challenges
### Scalability  
The choice of a simulation tool depends significantly on the type of applications. This fact also dictates the granularity of the simulation. For example, macroscopic phenomena, such as routing strategies, can be studied by packet-level, using the DES approach. Notwithstanding this, a very accurate simulation might substantially hinder performance leading to similar results as other faster performing methods. Another key point when considering a simulation framework is the generality of the range of phenomena and applications that can be simulated. More general simulation frameworks are usually not focused on specific characteristics, but rather on a large number of parameters that may not be required by the user and may be very complex to setup and operate. These frameworks tend to cover a wide variety of applications and phenomena. On the other hand, dedicated simulation solutions are usually easier to use, tailored and optimised to specific applications and their complexity. However, dedicated solutions are not easily adaptable to other applications, without significant development effort. In our analysis of extant simulation frameworks for fog and edge computing, many are extensions of _CloudSim_ and suffer from its limitations in terms of scale and focus. Others focus on specific use case scenarios. These present short term limitations for fog and cloud computing researchers but also opportunities for simulation research. Experimenting with large scale systems requires compute resources to be available for a simulation framework to use. DES is the most popular approach used in cloud computing, as reflected in the above analysis. However, the sequential nature of the event queue is notoriously difficult to parallelize as each event can change the state of the system. Therefore, if an event is processed out of order the calculation may be incorrect. Having said that, where one can make clear divisions within the model, simulation events can be processed in independent clusters increasing the degree of parallelism. For example [PERSON] and [PERSON] [PERSON] and [PERSON] (2018) discuss a parallel discrete event simulation (PDES) approach that is capable of distribute simulation over multiple processors and machines, also avoiding memory bottlenecks by dividing the model across machines. Another example is _Cloud2 Sim_, an extension of popular CloudSim ([PERSON] et al., 2017) framework using Hazelcast and Infinispan in memory distributed data stores ([PERSON] and [PERSON], 2018). As seen in Table 1 parallel DES execution is not widely adopted in newly released edge simulation tools limiting their application range. The Discrete Time Simulation (DTS) approach can be used to attempt to combat such parallelisation difficulties associated with DES. DTS uses the concept of time-step to update the state of the system components, avoiding the need for pre-computation and storage of future events. This approach presents a significant reduction of the simulator's memory requirements and enhances performance while enabling parallel processing ([PERSON] and [PERSON], 2018), and, along with reduced memory requirements, provides a mechanism for the simulation of very large networks. The state of all components involved in a simulation e.g., sites, nodes, VMs, etc, can be updated in parallel, since, there are no dependencies between components thus enhancing scalability. The change of state of the constituent components is only affected by input requests. This approach substantially simplifies the design and incorporation of advanced power consumption models and strategies for path formation on networks. Furthermore, the granularity of the simulation is controlled by the choice of timestep - choosing a smaller timestep results in a very large number of timesteps, potentially increasing the accuracy of the simulation, while hindering performance. A large timestep typically results in the undersampling of the studied phenomenon neglecting transient phenomena that might substantially affect the result of the simulation.