Slide 1

Slide 1 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 1 Iwan Setiawan iFogSim: Introduction

Slide 2

Slide 2 text

Advanced Computer Networks Tutorials, Spring 2021, CSIE NTUST 2 Iwan Setiawan IoT Tutorials: Recall ● Temperature monitoring – CPU w/ GPIO Zero – DHT11 w/ Adafruit DHT ● Writing data to a CSV file ● Displaying the data to a live graph with matplotlib ● Actions: LED and buzzer Analog signal Compute Storage Digital signal Stallings, 2016 Communications +Humidity 1 2 4 5 +Notification Cloud Compute Storage Simple * https://components101.com/sensors/dht11-temperature-sensor DHT11* 3 CSV

Slide 3

Slide 3 text

Advanced Computer Networks Tutorials, Spring 2021, CSIE NTUST 3 Iwan Setiawan IoT device IoT Tutorials: Recall ● Temperature monitoring – CPU w/ GPIO Zero – DHT11 w/ Adafruit DHT ● Writing data to a CSV file ● Displaying the data to a live graph with matplotlib ● Actions: LED and buzzer +Humidity +Notification Cloud * https://components101.com/sensors/dht11-temperature-sensor Sensor Actuator

Slide 4

Slide 4 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 4 Iwan Setiawan Objectives ● Learn iFogSim and the components ● Learn how to set up iFogSim on IntelliJ IDEA ● Learn how to run code examples

Slide 5

Slide 5 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 5 Iwan Setiawan Cloud Computing Stallings, 2016 Computing, Storage, Networking

Slide 6

Slide 6 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 6 Iwan Setiawan IoT Cloud Platforms Cloud IoT Core IoT Azure IoT Losant ThingsBoard

Slide 7

Slide 7 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 7 Iwan Setiawan Limitations of Cloud Computing ● Distance: multi-hop, far from the data sources ● Latency: uncertainty in the network, needed for real- time and critical services, processing near the sources ● Connection: massive and stable connections for IoT devices distributed geographically, network congestion – A huge number of IoT devices connect to the cloud – These devices send data frequently (big volume) – Need network resources, e.g. bandwidth Security and privacy

Slide 8

Slide 8 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 8 Iwan Setiawan Diverse resource capabilities Edge/Fog Nodes ● Micro data centers (Micro DCs) ● Base stations* ● Cloudlets ● Other types of edge nodes – Vehicles with onboard computers – IoT gateways – Smartphones * Related to multi-access edge computing or mobile edge computing (MEC)

Slide 9

Slide 9 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 9 Iwan Setiawan Cloud, Edge, and Fog Chang, Srirama, and Buyya, 2019

Slide 10

Slide 10 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 10 Iwan Setiawan Cloud, Edge, and Fog ● Edge computing is placed at the edge networks – Outside core network: inner, middle, or outer edges – It does not necessarily connect to the cloud ● Edge nodes can be called fog nodes if they extend the cloud* (more likely) – Resource constrained fog nodes – IoT environments: heterogenous, distributed, coordinated – Combined cloud-fog resource management * or connect to/depend on/integrated with the cloud

Slide 11

Slide 11 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 11 Iwan Setiawan Cloud, Edge, and Fog Fog Edge Cloud Lower Fog Higher Fog Cloud iFogSim

Slide 12

Slide 12 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 12 Iwan Setiawan IoT Applications and Fog-Cloud Chang, Srirama, and Buyya, 2019 Real-time analytics and decision making Real-time requirements

Slide 13

Slide 13 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 13 Iwan Setiawan IoT Applications and Fog-Cloud ● An application needs to be partitioned – Based on distributed data flow (DDF) model – Modular: application modules, run in distributed manner – Requirements: real-time services, quality of service (QoS) ● Application modules needs to be placed – Resources: pool of fog nodes – Coordination: fog-to-cloud resources ● Resource management policies – Application module placement in the pool of fog nodes – Scheduling for application modules (Resource allocation)

Slide 14

Slide 14 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 14 Iwan Setiawan iFogSim ● A toolkit to model and simulate edge/fog computing environments – Simulate IoT devices, fog nodes, cloud DCs, and network links – Using sense-process-actuate and DDF models ● Evaluating resource management and scheduling policies across edge/fog and cloud resources ● Metrics: latency, network usage, power consumption, operational costs Based on CloudSim

Slide 15

Slide 15 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 15 Iwan Setiawan iFogSim Architecture Gupta et al., 2017

Slide 16

Slide 16 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 16 Iwan Setiawan FogGUI Fog IoT device IoT device IoT device IoT device

Slide 17

Slide 17 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 17 Iwan Setiawan

Slide 18

Slide 18 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 18 Iwan Setiawan Preparation ● Java JDK 8+ ● IntelliJ IDEA Community ● iFogSim2 – New features: mobility, clustering, microservices – Repo: https://github.com/Cloudslab/iFogSim Internet connection

Slide 19

Slide 19 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 19 Iwan Setiawan iFogSim2 Mahmud et al., 2021

Slide 20

Slide 20 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 20 Iwan Setiawan How to Set up iFogSim2 ● Get it from the GitHub repository – git clone https://github.com/Cloudslab/iFogSim – or, download it from Code menu, and Download ZIP ● Choose Import Project, select iFogSim repo dir ● Choose Create from existing source ● Follow import wizard: source files, libraries (jars), module structure, project SDK

Slide 21

Slide 21 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 21 Iwan Setiawan Setting up Project Structure ● Choose Modules and select iFogSim-main ● Make sure Language level set to “8” or above

Slide 22

Slide 22 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 22 Iwan Setiawan

Slide 23

Slide 23 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 23 Iwan Setiawan Libraries ● Make sure required libraries can be accessed – Apache Commons Math – JSON.simple ● Add manually if needed – Project Structure-Project Settings-Libraries ● Check your Java environment

Slide 24

Slide 24 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 24 Iwan Setiawan

Slide 25

Slide 25 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 25 Iwan Setiawan Project Tree Structure ● Libraries – JDK environment (External Libraries) – Needed Java packages in JAR format (jars) ● Apache Commons Math ● JSON.simple ● Source (src) – org/cloudbus.cloudsim* including sdn* – org/fog.* ● Other directories: dataset, output, results, topologies

Slide 26

Slide 26 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 26 Iwan Setiawan

Slide 27

Slide 27 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 27 Iwan Setiawan iFogSim components Mahmud and Buyya, 2019 Infrastructure Services Policies

Slide 28

Slide 28 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 28 Iwan Setiawan Fundamental Classes Gupta et al., 2017 * Learn about iFogSim Entities: https://cloudsimtutorials.online/ifogsim-entities/

Slide 29

Slide 29 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 29 Iwan Setiawan Physical Components ● Fog devices or nodes – Act like DCs in cloud computing: task processing by hosting application modules – Interconnected and orchestrated in hierarchical order: higher and lower devices – Attributes: processing rate, power consumption ● Sensors – Generate tuples or tasks (similar to cloudlet in CloudSim) – Tuples creation is event-driven, relate to specific sensor and actuator – Two tuples generation interval follows deterministic distribution ● Actuators – Defining the effect of actuation and network connection properties – Each actuator is associated with corresponding sensor IoT data streams

Slide 30

Slide 30 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 30 Iwan Setiawan Logical Components ● Application modules (AppModules) – Applications: a collection of interdependent AppModules (DDF model) – Can be mapped with virtual machines (VMs) in cloud computing – Each AppModule handles a particular type of tuples coming from the previous AppModule of the dataflow ● Application edges (AppEdges) – Dependency between two modules or AppModules (Logical dataflow) – Tuple forwarding between two AppModules can be periodic or event-based – Upon receiving a specific type of tuple, whether a module triggers another tuple of different type to the next module is determined by fractional selectivity model * Selectivity models: bursty and fractional. See org.fog.application.selectivity

Slide 31

Slide 31 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 31 Iwan Setiawan Management Components ● Module Mapping object – Identifying available resources in the fog devices and place them based on modules or AppModules’ requirements – By default: hierarchical module placement – If module reqs. cannot be met by a fog device, it will be sent to higher level fog ● Controller object – Launching AppModules on their assigned fog devices following the placement information provided by Module Mapping object – Managing the resources of fog devices periodically – Gathering results of cost, network usage, and energy consumption

Slide 32

Slide 32 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 32 Iwan Setiawan Sequence Diagram Gupta et al., 2017

Slide 33

Slide 33 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 33 Iwan Setiawan Building a Simulation: Physical ● Create physical components (fog devices, sensors, actuators) with config. params. – Processing capability in MIPS – RAM in megabytes – Cost per million instruction processing – Uplink and downlink bandwidth – Busy and idle power – Hierarchical level of fog devices ● Value in the transmitDistribution object is set when creating IoT sensors, and associated with sensing interval (transmit rate) – Sensor and actuators are created with the ref. of application ID and broker ID ● Workload: tuples and resources required to process them

Slide 34

Slide 34 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 34 Iwan Setiawan Building a Simulation: Logical ● Create logical components, with directed acyclic graph (DAG) – AppModule, with configuration – AppEdge ● Include the types of tuples, directions, CPU and networking (N/W) lengths, with the reference of source and destination modules ● Different types of tuples are created based on the given specifications on AppEdge objects – AppLoop ● Additional class for specifying process-control loops ● Control loops can be used to measure end-to-end latency ● The instance is basically list of AppModules with the start and end of the loop

Slide 35

Slide 35 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 35 Iwan Setiawan Building a Simulation: Management ● Create management components – AppModule placement and scheduling policies ● Module mapping or placement ● Controller – Considerations: service/processing latency, power consumption, throughput, operational cost, device constraints/heterogeneity – The requirements of an AppModule must be aligned with: ● specifications of corresponding tuple type ● satisfied by the available fog resources – After mapping of AppModule and fog devices, the physical and logical components information is sent to the controller object – The controller object will send the whole system to CloudSim engine

Slide 36

Slide 36 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 36 Iwan Setiawan Code Examples ● VRGameFog: /src/org/fog/test/perfeval/VRGameFog.Java ● DCNSFog: /src/org/fog/test/perfeval/DCNSFog.Java

Slide 37

Slide 37 text

Cloud Computing Tutorials, Fall 2021, CSIE NTUST 37 Iwan Setiawan References [1] C. Chang, S. N. Srirama, and R. Buyya, “Internet of things (IoT) and new computing paradigms,” in Fog and Edge Computing: Principles and Paradigms, 1st ed. Wiley, 2019. [2] R. Mahmud and R. Buyya, “Modeling and simulation of fog and edge computing environments using iFogSim toolkit,” in Fog and Edge Computing: Principles and Paradigms, 1st ed. Wiley, 2019. [3] H. Gupta, A. Vahid Dastjerdi, S.K. Ghosh, and R. Buyya, “iFogSim: A toolkit for modeling and simulation of resource management techniques in the internet of things, edge and fog computing environments,” Software: Practice and Experience, vol. 47, no. 9, pp. 1275-1296, 2017. [4] A. Singh, “iFogsim project structure: a beginners guide,” 2021. [Online]. Available: https://cloudsimtutorials.online/ifogsim-project-structure-a-beginners-guide/