New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable...

43
Enabling distributed, compute-intensive FaaS on the edge with COMPSs Francesc Lordan 14/04/2019 Edge Computing Workshop@ASPLOS’19

Transcript of New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable...

Page 1: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

Enablingdistributed,compute-intensiveFaaS ontheedgewithCOMPSs

FrancescLordan

14/04/2019 Edge ComputingWorkshop@ASPLOS’19

Page 2: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

Outline

• Motivation• Programming Model:COMPSs• DecentralizingtheCOMPSsruntime• UseCase:CagliariAirport• Conclusion

Page 3: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

Motivation

Page 4: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

IoT/EdgePlatforms

4

3types ofelements composing the system:

Events/DataGenerators (sensors)elementsmonitorizingcertainconditionandinforming about it

Continuosly generating informationà Streams ofdataEventually notifying achangeà Events

Event-reactors/DataConsumers(displays)elements on which the platform realizes actions (changing its state)

Computingelementselementswithintheinfrastructurewithabilitytoprocessandtransforminformation

Page 5: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

5

Cloud-EdgeContinuum

Page 6: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

Computation on IoT/Edge platforms3purposes for computation:

• Sense-process-actuate:Asensordetects something andtriggers acomputation togive aproper responsetosuchevent.

• Stream processing:Asensorcontinuously provides datathat needs tobeprocessed.

• Batch Jobs:Analyse big amounts ofdatacollected by the sensors

Page 7: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

Programming Model:COMPSs

Page 8: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

BSCvisiononprogrammingmodels

8

GeneralpurposeTaskbased

Singleaddressspace

Intelligentruntime,parallelization,distribution,

interoperability

Programlogicindependentof

computingplatformApplications

Powertotheruntime

ProgrammingModel:High-level,clean,abstract

MiddlewareAPI

SimpleParallelProgrammingModel• WhatdoIneedtocompute?• WhatdatadoIneedtouse?• ProvideHints

LetthedifficultpartstotheruntimeActonbehalfoftheuser

EnableMonitoringandAnalysisGeneratedatatoevaluatehowapplicationperforms

Page 9: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

COMPSuperscalar(COMPSs)• Generalpurposeprogramminglanguage+annotations/hints• SequentialprogrammingwithnoAPIcalls• Agnosticofthecomputinginfrastructure• Task-based:taskistheunitofwork

• Buildsataskgraphatruntimethatexpresspotentialconcurrency• Implicitworkflow

• Exploitationofparallelism• …andofdistantparallelism

Page 10: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

public class Matmul {

public static void main (String[] args) {

int[][] A;

int[][] B;

...

int[][] C = multiply(A, B);

...

}

}

public class Simple {

public static int[][] multiply (

int[][] A, int[][] B) {

// Matrix multiplication code

// C = AB

...

return C;

}

}

CEI.javapublic interface CEI {

@Method(declaringClass = ”Simple”)

public int[][] multiply (

@Parameter(direction = IN) int[][] A,

@Parameter(direction = IN) int[][] B

);

}

Matmul.java Simple.java

COMPSs Example - Java

Page 11: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

COMPSs Runtime

COMPSs Master

COMPSs runtime

Access Processor

Scheduler

Resources

Loader Bindings-commonsC Python

Applicationmain(args)

Task Task

Task

Page 12: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

Decentralizing theCOMPSs runtime

Page 13: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

Environment differencesCOMPSs’usualflow:• 1application• Infrastructureisstable• 1node(MASTER):

• Spawnstasks• Orchestratestheexecutionovertheavailableresources(WORKERs)

COMPSsforEdgeComputing• Napplicationsatthesametime• Infrastructureisdynamic• Anyagentmaygeneratenewtasks• Executionorchestrationisasharedresponsibility

Page 14: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

COMPSs Agent

COMPSs agent

Access Processor

Scheduler

Resources

Agent InterfaceStart AppRequest• Class• Method• Params• CEI

Task

Application

LoaderBindings-commons

C Python

Page 15: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

Agents interaction

ComputingAgent

Localdevices

Scheduler

AccessProcessor

Remoteagent

ComputingAgent

Localdevices

Scheduler

AccessProcessor

Remoteagent

Page 16: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

Computingagents hierarchy

ComputingAgent

Localdevices

Scheduler

AccessProcessor

Remoteagent

ComputingAgent

Localdevices

Scheduler

AccessProcessor

Remoteagent

Remoteagent

Remoteagent

ComputingAgent

Localdevices

Scheduler

AccessProcessor

Remoteagent

ComputingAgent

Localdevices

Scheduler

AccessProcessor

Remoteagent

ComputingAgent

Localdevices

Scheduler

AccessProcessor

Remoteagent

Remoteagent

Page 17: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

UseCase:Cagliari(IT)airport

Page 18: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

SmartFog-Hub ServiceIn2017morethan4billionpassengersconcentratedinairports

• Features• trackthepresenceofpeopleandobjectsinthefield• proximitymarketingservices• suggestionsonbestuseofairportservices• Recommendersystembasedonconsumers’behavior

• Objectives• Reducelatencyandresponsetimes• Capabilitytodistributecomputingincaseofoverloading• Pleasantexperiencefortravelerswhileintheairportfield

Page 19: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

Customer Experience

.

Flight AZ626 now boarding, gate B32

Sardinian handcraft

2

3

4

1

App install,topics setting

Page 20: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

AndroidApp

Page 21: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

Dashboard

Page 22: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

UseCasedeployment

Page 23: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

(A)

(B)

(C)

(D)

Benchmarkingscenarios

Page 24: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

TestResults

Page 25: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

Conclusions

Page 26: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

Summary• IoT/Edge infrastructures arecomposed ofautonomous nodes with networkandcomputing capabilities

• COMPSs• Developers code being unaware ofthe parallelism andinfrastructure-related concerns• Detects tasks andthe parallelism inherent inthe application• Orchestrates the execution ofthese tasks on the available infrastructure• Supports computation on the three scenarios (batch,stream andsense-process-actuate)

• COMPSs agents• Allows devices toremain autonomous andcomputeinan isolated manner• By interacting with other agents,andagent hasaccess tothe available computing power

• The airport usecaseshowsthe viability andthe benefits ofthe presentedsolution

Page 27: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

THANKYOU!

www.bsc.es

[email protected]

Page 28: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

COMPSs

Page 29: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

COMPSs Runtime• COMPSsapplicationsexecutedindistributedmodefollowingthemaster-workerparadigm

• Sequentialexecutionstartsinmasternode• Tasksareoffloadedtoworkernodes• Alldataschedulingdecisionsanddatatransfersareperformedbytheruntime

Task Dependecy Graph Computing infrastructure

COMPSs Runtime ResourceMgmt.

TaskExecutionSchedulingTask

AnalysisDataMgmt.

Monitoring

Files, objects

Tasks

Annotatedapplication

code

Page 30: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

Resource 2

1. Identify tasks

main program {

}

2. Select tasks

taskA(...);

taskB(...);

(C++/Java)taskselectioninterface{

}(Python)@taskdecorator

taskA

taskBTask

Unitofparallelism

. . .

taskA

Asynchrony

taskB

Resource 1 Resource N

ProgrammingSteps

Page 31: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

Programming Model Examplefor (i = 0; i < 3; i++) {

increment(counter1);increment(counter2);increment(counter3);

}printCounters(counter1, counter2, counter3);

counter1 counter2 counter3

1st iteration

2nd iteration

3rd iteration

public interface SimpleItf {

@Method(declaringClass = “SimpleImpl")void increment(

@Parameter(type = FILE, direction = INOUT)String counterFile

);

}Parametermetadata

Implementation

Page 32: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

AdvancedFeatures

• Constraintstosupportheterogeneoustasks• @Constraints(…)

• Versioning• @Implements(…)

• Combinationofbinaryexecution• @Binary(…)

• IntegrationwithProgrammingModels• @MPI(..)@Decaf(…)• COMPSs+OmpSs

• Nested• @COMPSs(…)

Page 33: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

ExecutionEnvironments• InteractiveNodes

• Clouds

• Clusters

• Containers

Page 34: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

SchedulingPolicies

RuntimeExtensions

Runtime System

Resource Management

Job Submission & Data Transfer

Scheduling

Task Analysis Data Access & Locality

Monitoring& Tracing

ResourceProviders

Comm. Protocols

Persistent Objects

project.xml resources.xml

Executioncommands:• runcompss (interactive&cloud)• enqueue_compss (clusters)• Runcompss_docker (socker clusters)

Page 35: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

mF2C

Page 36: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

Background – OpenFog

Thearchitecture isanextensionofthetraditionalcloudcomputingmodel

• Processesaremovedfromthecloudtotheedgeofthenetwork,inFognodes

• Deploymentscanresideonmultiplelayersofanetworktopology,

• Deploymentsretainallthebenefitsofcloudcomputing,suchascontainerization,virtualization,orchestration, resource-efficientmanagement

FogNodespeculiarities

• Autonomousprocessing

• LocalstorageandIPcommunications

• Hostedinopen(evenhostile)fields

• Capableofactinginmobility

Page 37: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

mF2Carchitecture

Page 38: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

Usecasearchitecture• Cloud – basedonaOpenStackinstance,wiredconnectedwiththefoglayers,providingscalablecomputingpowerforMachineLearningalgorithms

• EdgeFog– withafogaggregatorbasedonNuvlabox with8GB,providingreal-timecomputingandstorageresourcesand6rPIwith1GBhubprovidingsessionmanagementandfastresponsetotheedgedevices

• EdgeIoT – Androidsmartphonesconnectedtotheedgenodesthroughwifi,andusinganAndroidapptointeractwiththesystem

Page 39: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

• Proximity processing• Client – call arequest for alist ofnearby POIs using geographic position• Server– calculates the POIs inproximity andreturns aJSONarray

• ClientSmartphone XIAOMI with Android 5.0.2, running app calling a Rest HTTP API

• Server• AVMruns adockerized image with proximity calculation1. rPI3with 1GBRAM2. VMrunningon apublic cloud (4-coreprocessor and4GBRAM)

Testbed

Page 40: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

Interaction withIoT devices

Page 41: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

Interaction with sensors

• Everysensorisattachedtoonedevicewithcomputingcapabilities

• Events:the device trigger afunction execution on any COMPSs agent

• Streams:the device publishes the stream ofdatadirectly

Page 42: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

• Through aController class• Handles all the communication with the device• Offers asimpleAPItointeract with the device

• Each instance ofthis controller class interacts with one device• Device canbecontrolled by any agent if the object is transferred

public void task(Streetlamp sl) {

…sl.on();…

}

Interaction with displays/devices

class Streetlamp {

public void on() {…

}

public void off() {…

}}

Page 43: New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable Monitoring and Analysis Generate data to evaluate how application performs. COMP Superscalar

• Using the storage framework• Controller class is aPersistent Object• One Controller instance is made persistent for each device using auniversalID• Any agent able caninteract with any registered resource by using an ID

public void task() {

…Streetlamp sl;sl = Storage.getByAlias(“light21758”);sl.on();…

}

Interaction with displays/devices

class Streetlampextends StorageObject {

public void on() {…

}

public void off() {…

}}

Streetlamp sl = new Streetlamp();sl.makePersistent(“light21758”);

StorageFramework

COMPSs task

Device Manager