ThingsJS: Towards a Flexible and Self-Adaptable Middleware for - - PowerPoint PPT Presentation

thingsjs towards a flexible and self adaptable middleware
SMART_READER_LITE
LIVE PREVIEW

ThingsJS: Towards a Flexible and Self-Adaptable Middleware for - - PowerPoint PPT Presentation

Motivation ThingsJS Scheduling Code Migration Communications ThingsJS: Towards a Flexible and Self-Adaptable Middleware for Dynamic and Heterogeneous IoT Environments Middleware for IoT m4iot@Middleware 2017 Julien Gascon-Samson,


slide-1
SLIDE 1

Motivation ThingsJS Scheduling Code Migration Communications

ThingsJS: Towards a Flexible and Self-Adaptable Middleware for Dynamic and Heterogeneous IoT Environments

Middleware for IoT – m4iot@Middleware 2017 Julien Gascon-Samson, Mohammad Rafiuzzaman, Karthik Pattabiraman

University of British Columbia Department of Electrical and Computer Engineering Vancouver, Canada

December 11, 2017

slide-2
SLIDE 2

Motivation ThingsJS Scheduling Code Migration Communications

Motivation

2

World of IoT growing at a very fast pace!

slide-3
SLIDE 3

Motivation ThingsJS Scheduling Code Migration Communications

Motivation

2

World of IoT growing at a very fast pace! Traditionaly, processing was done in the cloud

slide-4
SLIDE 4

Motivation ThingsJS Scheduling Code Migration Communications

Motivation

2

World of IoT growing at a very fast pace! Traditionaly, processing was done in the cloud Emerging trend: running applications on the IoT devices themselves (edge)

Performance, costs, reliability

slide-5
SLIDE 5

Motivation ThingsJS Scheduling Code Migration Communications

Goals and Motivation

3

ThingsJS: a framework for developing and deploying high-level applications on IoT devices (edge computing)

slide-6
SLIDE 6

Motivation ThingsJS Scheduling Code Migration Communications

Goals and Motivation

4

ThingsJS: a framework for developing and deploying high-level applications on IoT devices (edge computing) Programmers are typically more productive in higher-level languages JavaScript: strong user base

slide-7
SLIDE 7

Motivation ThingsJS Scheduling Code Migration Communications

Goals and Motivation

4

ThingsJS: a framework for developing and deploying high-level applications on IoT devices (edge computing) Programmers are typically more productive in higher-level languages JavaScript: strong user base

slide-8
SLIDE 8

Motivation ThingsJS Scheduling Code Migration Communications

Goals and Motivation

4

ThingsJS: a framework for developing and deploying high-level applications on IoT devices (edge computing) Programmers are typically more productive in higher-level languages JavaScript: strong user base JavaScript VMs on IoT Samsung IoT.js Intel XDK DukServer Smart.js Node.js on IoT devices

slide-9
SLIDE 9

Motivation ThingsJS Scheduling Code Migration Communications

Goals and Motivation

4

Constraints IoT world is highly heterogeneous!

Different hardware platforms OSes Environments

ThingsJS: Declarative language for expressing constraints

Over the devices Over the applications

Programmers are typically more productive in higher-level languages JavaScript: strong user base JavaScript VMs on IoT Samsung IoT.js Intel XDK DukServer Smart.js Node.js on IoT devices

slide-10
SLIDE 10

Motivation ThingsJS Scheduling Code Migration Communications

Goals and Motivation

5

ThingsJS: a framework for developing and deploying high-level applications on IoT devices (edge computing)

1

Scheduling Applications

  • n IoT Devices

Scheduling Given a set of IoT applications (“components”) Given a set of constraints ⇓

slide-11
SLIDE 11

Motivation ThingsJS Scheduling Code Migration Communications

Goals and Motivation

5

ThingsJS: a framework for developing and deploying high-level applications on IoT devices (edge computing)

1

Scheduling Applications

  • n IoT Devices

Scheduling Given a set of IoT applications (“components”) Given a set of constraints ⇓ What is the optimal mapping

  • f components to devices?

Significant work on scheduling applications in the cloud – idea of scheduling applications in the edge is relatively novel

slide-12
SLIDE 12

Motivation ThingsJS Scheduling Code Migration Communications

Goals and Motivation

6

ThingsJS: a framework for developing and deploying high-level applications on IoT devices (edge computing)

1

Scheduling Applications

  • n IoT Devices

Example: motion detection video_camera: tied to hardware motion_detect: detects motion

slide-13
SLIDE 13

Motivation ThingsJS Scheduling Code Migration Communications

Goals and Motivation

6

ThingsJS: a framework for developing and deploying high-level applications on IoT devices (edge computing)

1

Scheduling Applications

  • n IoT Devices

Example: motion detection video_camera: tied to hardware motion_detect: detects motion Some components can/should be run in the cloud

slide-14
SLIDE 14

Motivation ThingsJS Scheduling Code Migration Communications

Goals and Motivation

7

ThingsJS: a framework for developing and deploying high-level applications on IoT devices (edge computing)

1

Scheduling Applications on IoT Devices

2

Migrating IoT Applications

Migration Conditions change over time IoT devices are resource-constrained

slide-15
SLIDE 15

Motivation ThingsJS Scheduling Code Migration Communications

Goals and Motivation

7

ThingsJS: a framework for developing and deploying high-level applications on IoT devices (edge computing)

1

Scheduling Applications on IoT Devices

2

Migrating IoT Applications

Migration Conditions change over time IoT devices are resource-constrained It might be necessary to migrate components

slide-16
SLIDE 16

Motivation ThingsJS Scheduling Code Migration Communications

Goals and Motivation

7

ThingsJS: a framework for developing and deploying high-level applications on IoT devices (edge computing)

1

Scheduling Applications on IoT Devices

2

Migrating IoT Applications

Migration Conditions change over time IoT devices are resource-constrained It might be necessary to migrate components Prior work: migrating web applications across browsers

slide-17
SLIDE 17

Motivation ThingsJS Scheduling Code Migration Communications

Goals and Motivation

8

ThingsJS: a framework for developing and deploying high-level applications on IoT devices (edge computing)

1

Scheduling Applications on IoT Devices

2

Migrating IoT Applications

3

Optimizing the Communications

Publish/Subcribe - MQTT Publish/subscribe maps well to IoT (MQTT: iso standard)

slide-18
SLIDE 18

Motivation ThingsJS Scheduling Code Migration Communications

Goals and Motivation

8

ThingsJS: a framework for developing and deploying high-level applications on IoT devices (edge computing)

1

Scheduling Applications on IoT Devices

2

Migrating IoT Applications

3

Optimizing the Communications

Publish/Subcribe - MQTT Publish/subscribe maps well to IoT (MQTT: iso standard) Significant work in cloud/p2p pub/sub

slide-19
SLIDE 19

Motivation ThingsJS Scheduling Code Migration Communications

Goals and Motivation

8

ThingsJS: a framework for developing and deploying high-level applications on IoT devices (edge computing)

1

Scheduling Applications on IoT Devices

2

Migrating IoT Applications

3

Optimizing the Communications

Publish/Subcribe - MQTT Publish/subscribe maps well to IoT (MQTT: iso standard) Significant work in cloud/p2p pub/sub Adapting pub/sub architectures for IoT

slide-20
SLIDE 20

Motivation ThingsJS Scheduling Code Migration Communications

ThingsJS: IoT Runtime Middleware

9

1

Goals and Motivation

2

ThingsJS: IoT Runtime Middleware

3

Dynamic Scheduling

4

JavaScript Code Migration

5

Inter-Component Communications

slide-21
SLIDE 21

Motivation ThingsJS Scheduling Code Migration Communications

ThingsJS

10

slide-22
SLIDE 22

Motivation ThingsJS Scheduling Code Migration Communications

ThingsJS Application

11

Source Code: High-Level Language (i.e., Javascript - Node.js) Code written in terms of “components” Constraints: Physical: device-related Logical: component-related

slide-23
SLIDE 23

Motivation ThingsJS Scheduling Code Migration Communications

ThingsJS Application

11

Source Code: High-Level Language (i.e., Javascript - Node.js) Code written in terms of “components” Constraints: Physical: device-related Logical: component-related CPU (workload units) RAM Available incoming &

  • utgoing bandwidth
slide-24
SLIDE 24

Motivation ThingsJS Scheduling Code Migration Communications

ThingsJS Application

11

Source Code: High-Level Language (i.e., Javascript - Node.js) Code written in terms of “components” Constraints: Physical: device-related Logical: component-related Workload units RAM Incoming & outgoing bandwidth Inter-component constraints: latency, bandwidth

slide-25
SLIDE 25

Motivation ThingsJS Scheduling Code Migration Communications

ThingsJS Middleware

12

slide-26
SLIDE 26

Motivation ThingsJS Scheduling Code Migration Communications

Dynamic Scheduling

13

1

Goals and Motivation

2

ThingsJS: IoT Runtime Middleware

3

Dynamic Scheduling

4

JavaScript Code Migration

5

Inter-Component Communications

slide-27
SLIDE 27

Motivation ThingsJS Scheduling Code Migration Communications

Scheduling Applications on Things (1)

14 1 Predicting the workload of components

Machine-learning Training:

Several devices, different load profiles Monitoring performance (execution time) Construction of a model

Predicting:

Execution time on device With a specific load level

2 Scheduling the placement of components to devices

slide-28
SLIDE 28

Motivation ThingsJS Scheduling Code Migration Communications

Scheduling Applications on Things (2)

15 1 Predicting the workload of components 2 Scheduling the placement of components to devices

Given a set of constraints ...and the prediction model What is the optimal arrangement of components-to-devices? Respecting all constraints SMT Solver Most suitable global solution Rescheduling?

slide-29
SLIDE 29

Motivation ThingsJS Scheduling Code Migration Communications

ThingsMigrate: Migrating JavaScript IoT Applications

16

1

Goals and Motivation

2

ThingsJS: IoT Runtime Middleware

3

Dynamic Scheduling

4

JavaScript Code Migration

5

Inter-Component Communications

slide-30
SLIDE 30

Motivation ThingsJS Scheduling Code Migration Communications

Constraints

17

Portability: heterogeneous devices, cloud (cloud-edge computing)

No modifications to VM

Stateful applications Asynchroneous nature of JS

slide-31
SLIDE 31

Motivation ThingsJS Scheduling Code Migration Communications

Challenges and Approach

18

1

f u n c t i o n Counter ( v a l ) {

2

var v a l u e = v a l ;

3 4

return f u n c t i o n () {

5

v a l u e = v a l u e + 1;

6

// Can access parent function local variable

7

return v a l u e ;

8

}

9

};

10 11

var f = Counter (5) ;

12

var g = Counter (2) ;

13 14

document . w r i t e l n ( f () ) ; // Prints 6

15

document . w r i t e l n ( g () ) ; // Prints 3 1 Closures 2 Timers 3 Asynchronous

Model (Event-Based)

slide-32
SLIDE 32

Motivation ThingsJS Scheduling Code Migration Communications

Challenges and Approach

18

1

f u n c t i o n Counter ( v a l ) {

2

var v a l u e = v a l ;

3 4

return f u n c t i o n () {

5

v a l u e = v a l u e + 1;

6

// Can access parent function local variable

7

return v a l u e ;

8

}

9

};

10 11

var f = Counter (5) ;

12

var g = Counter (2) ;

13 14

document . w r i t e l n ( f () ) ; // Prints 6

15

document . w r i t e l n ( g () ) ; // Prints 3 1 Closures 2 Timers 3 Asynchronous

Model (Event-Based) ⇓

1 Code

Instrumentation

2 State Serialization 3 Code

Reconstruction

slide-33
SLIDE 33

Motivation ThingsJS Scheduling Code Migration Communications

Inter-Component Communications

19

1

Goals and Motivation

2

ThingsJS: IoT Runtime Middleware

3

Dynamic Scheduling

4

JavaScript Code Migration

5

Inter-Component Communications

slide-34
SLIDE 34

Motivation ThingsJS Scheduling Code Migration Communications

Topic-Based Publish/Subscribe

20

Easy decoupling of content producers from content consumers Abstraction of network-related considerations

1 // ... 2 3 // Connect 4 pubsub.connect(function() { 5 6 // Repeat every second 7 setInterval(function() { 8 9 // Read temperature from GPIO pin 10 var temperature = GPIO.readPin(12); 11 12 // Publish temperature 13 pubsub.publish("smartsensor/temperature", { 14 id: mySensorId, 15 temperature: temperature 16 }); 17 18 }, 1000); 19 20 });

slide-35
SLIDE 35

Motivation ThingsJS Scheduling Code Migration Communications

Topic-Based Publish/Subscribe

20

Easy decoupling of content producers from content consumers Abstraction of network-related considerations

1 // ... 2 3 // Connect 4 pubsub.connect(function() { 5 6 // Subscribe to temperature messages 7 pubsub.subscribe("smartsensor/temperature", function(d) { 8 9 if (d.temperature > threshold) { 10 pubsub.publish("smartsensor/actuation", { 11 id: d.id, 12 powerVariation: -5 13 }); 14 } else if (d.temperature < threshold) { 15 pubsub.publish("smartsensor/actuation", { 16 id: d.id, 17 powerVariation: 5 18 }); 19 } 20 21 }); 22 });

slide-36
SLIDE 36

Motivation ThingsJS Scheduling Code Migration Communications

Pub/Sub Adaptability

21

How should the pub/sub service be provided? In the cloud? Peer-to-peer (mesh)? Hybrid approaches?

Dynamic reconfiguration

Other pub/sub paradigms: content-based, graph-based

slide-37
SLIDE 37

Motivation ThingsJS Scheduling Code Migration Communications

Conclusion

22

Summary ThingsJS: IoT Runtime Middleware Publish/Subscribe: Inter-Component Communications Dynamic Scheduling Code Migration Research Team: Professor Karthik Pattabiraman Julien Gascon-Samson, PhD – NSERC Post-Doctoral Fellow Kumseok Jung – Master’s Student Mohammad Rafiuzzaman – PhD Student Resources: ThingsJS: http://thingsjs.juliengs.com GitHub: https://github.com/karthikp-ubc/ThingsJS