New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable...
Transcript of New Enabling distributed, compute-intensive FaaS on the edge with … · 2020. 7. 31. · Enable...
Enablingdistributed,compute-intensiveFaaS ontheedgewithCOMPSs
FrancescLordan
14/04/2019 Edge ComputingWorkshop@ASPLOS’19
Outline
• Motivation• Programming Model:COMPSs• DecentralizingtheCOMPSsruntime• UseCase:CagliariAirport• Conclusion
Motivation
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
5
Cloud-EdgeContinuum
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
Programming Model:COMPSs
BSCvisiononprogrammingmodels
8
GeneralpurposeTaskbased
Singleaddressspace
Intelligentruntime,parallelization,distribution,
interoperability
Programlogicindependentof
computingplatformApplications
Powertotheruntime
ProgrammingModel:High-level,clean,abstract
MiddlewareAPI
SimpleParallelProgrammingModel• WhatdoIneedtocompute?• WhatdatadoIneedtouse?• ProvideHints
LetthedifficultpartstotheruntimeActonbehalfoftheuser
EnableMonitoringandAnalysisGeneratedatatoevaluatehowapplicationperforms
COMPSuperscalar(COMPSs)• Generalpurposeprogramminglanguage+annotations/hints• SequentialprogrammingwithnoAPIcalls• Agnosticofthecomputinginfrastructure• Task-based:taskistheunitofwork
• Buildsataskgraphatruntimethatexpresspotentialconcurrency• Implicitworkflow
• Exploitationofparallelism• …andofdistantparallelism
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
COMPSs Runtime
COMPSs Master
COMPSs runtime
Access Processor
Scheduler
Resources
Loader Bindings-commonsC Python
Applicationmain(args)
Task Task
Task
Decentralizing theCOMPSs runtime
Environment differencesCOMPSs’usualflow:• 1application• Infrastructureisstable• 1node(MASTER):
• Spawnstasks• Orchestratestheexecutionovertheavailableresources(WORKERs)
COMPSsforEdgeComputing• Napplicationsatthesametime• Infrastructureisdynamic• Anyagentmaygeneratenewtasks• Executionorchestrationisasharedresponsibility
COMPSs Agent
COMPSs agent
Access Processor
Scheduler
Resources
Agent InterfaceStart AppRequest• Class• Method• Params• CEI
Task
Application
LoaderBindings-commons
C Python
Agents interaction
ComputingAgent
Localdevices
Scheduler
AccessProcessor
Remoteagent
ComputingAgent
Localdevices
Scheduler
AccessProcessor
Remoteagent
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
UseCase:Cagliari(IT)airport
SmartFog-Hub ServiceIn2017morethan4billionpassengersconcentratedinairports
• Features• trackthepresenceofpeopleandobjectsinthefield• proximitymarketingservices• suggestionsonbestuseofairportservices• Recommendersystembasedonconsumers’behavior
• Objectives• Reducelatencyandresponsetimes• Capabilitytodistributecomputingincaseofoverloading• Pleasantexperiencefortravelerswhileintheairportfield
Customer Experience
.
Flight AZ626 now boarding, gate B32
Sardinian handcraft
2
3
4
1
App install,topics setting
AndroidApp
Dashboard
UseCasedeployment
(A)
(B)
(C)
(D)
Benchmarkingscenarios
TestResults
Conclusions
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
COMPSs
COMPSs Runtime• COMPSsapplicationsexecutedindistributedmodefollowingthemaster-workerparadigm
• Sequentialexecutionstartsinmasternode• Tasksareoffloadedtoworkernodes• Alldataschedulingdecisionsanddatatransfersareperformedbytheruntime
Task Dependecy Graph Computing infrastructure
COMPSs Runtime ResourceMgmt.
TaskExecutionSchedulingTask
AnalysisDataMgmt.
Monitoring
Files, objects
Tasks
Annotatedapplication
code
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
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
AdvancedFeatures
• Constraintstosupportheterogeneoustasks• @Constraints(…)
• Versioning• @Implements(…)
• Combinationofbinaryexecution• @Binary(…)
• IntegrationwithProgrammingModels• @MPI(..)@Decaf(…)• COMPSs+OmpSs
• Nested• @COMPSs(…)
ExecutionEnvironments• InteractiveNodes
• Clouds
• Clusters
• Containers
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)
mF2C
Background – OpenFog
Thearchitecture isanextensionofthetraditionalcloudcomputingmodel
• Processesaremovedfromthecloudtotheedgeofthenetwork,inFognodes
• Deploymentscanresideonmultiplelayersofanetworktopology,
• Deploymentsretainallthebenefitsofcloudcomputing,suchascontainerization,virtualization,orchestration, resource-efficientmanagement
FogNodespeculiarities
• Autonomousprocessing
• LocalstorageandIPcommunications
• Hostedinopen(evenhostile)fields
• Capableofactinginmobility
mF2Carchitecture
Usecasearchitecture• Cloud – basedonaOpenStackinstance,wiredconnectedwiththefoglayers,providingscalablecomputingpowerforMachineLearningalgorithms
• EdgeFog– withafogaggregatorbasedonNuvlabox with8GB,providingreal-timecomputingandstorageresourcesand6rPIwith1GBhubprovidingsessionmanagementandfastresponsetotheedgedevices
• EdgeIoT – Androidsmartphonesconnectedtotheedgenodesthroughwifi,andusinganAndroidapptointeractwiththesystem
• 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
Interaction withIoT devices
Interaction with sensors
• Everysensorisattachedtoonedevicewithcomputingcapabilities
• Events:the device trigger afunction execution on any COMPSs agent
• Streams:the device publishes the stream ofdatadirectly
• 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() {…
}}
• 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