SlideShare a Scribd company logo
1 of 53
1
TOPIC
Developing Actors
in Azure with .NET
Marco Parenzan
Thanks for collaboration
Marco Parenzan
Senior Solution Architect @ beanTech/Smart Factory
1nn0va Community Lead (Pordenone)
Microsoft Azure MVP
Profiles
Linkedin: https://www.linkedin.com/in/marcoparenzan/
Slideshare: https://www.slideshare.net/marco.parenzan
GitHub: https://github.com/marcoparenzan
4
TOPIC
Developing Actors
in Azure with .NET
Marco Parenzan
Agenda
The need for a state
What is an Actor?
Already players in the Actor’s arena (really?)
Many ways to create actors
.net Orleans
Azure Durable Entities
Azure Digital Twins
“my own actor”
The need for a state
Scaling 3-tier architecture
(statelessstateful)
Data stream processing
Sampling
Aggregation
IoT
GPS Tracker (RFID, inventory, cars)
Counters (running total)
Sensor data
Service
Service Service
Stateless Services
My own problem
«Light» time window aggregation
Redis is good but not enough
Concurrency problem is «probabilistically» minimized, but not
solved
I worked on it about three years ago:
https://www.slideshare.net/marco.parenzan/stateful-stream-
processing-of-iiot-events-with-c-and-containers
Evaluate runtime expressions
Mature for enterprise grade «scripting languages»
Heavy for stateless approach
I’m still working on it:
https://www.slideshare.net/marco.parenzan/math-with-net-for-
you-and-azure
DEMO
shared state
concurrency, locks, and all that jazz
Stateful Services
What is an Actor?
The actor model in computer science is a mathematical
model of concurrent computation that treats actor as the
universal primitive of concurrent computation.
In response to a message it receives, an actor can: make
local decisions, create more actors, send more messages,
and determine how to respond to the next message
received.
Actors may modify their own private state, but can only
affect each other indirectly through messaging (removing
the need for lock-based synchronization).
From: https://en.wikipedia.org/wiki/Actor_model
Fundamental concepts
The actor model adopts the philosophy that everything is an
actor. This is similar to the everything is an
object philosophy used by some object-oriented
programming languages.
An actor is a computational entity that, in response to a
message it receives, can concurrently:
send a finite number of messages to other actors;
create a finite number of new actors;
designate the behavior to be used for the next message it
receives.
Multithreading
Thread 1
Objects
Thread 2
Objects
Shared
Resource
Actor Model
Single threaded
Not per actor, but thread
pool
One message at a time
(internal message queue)
No data sharing
Message passing
Actor
Single
Thread Internal
State
Actor Model
Message Passing
Points
Always expressed as theorydifficult
Affinity with microservices
it’s own state
Affinity with DDD
bounded contexts (messaging to get out the others)
aggregate roots (responsible for its own work)
Already players in the Actor’s arena (really?)
Sure!
Erlang
Azure Service Fabric
Akka.netThe «best»...but really the winner?
DAPRMicroservices in K8s (Actor is always one scenario)
What’s happened
Orleans is now .NET Foundation project since 2021
(https://dotnetfoundation.org/projects/spotlight?project=Orleans)
Alignment with with ASP.NET Core development model
.net Orleans
Grains and Silos
Grain: a virtual actor
Silo: a server instance,
holding many grains
Turn: processing a message
Activation: single living
instance of a grain
Activation and Life Cycle
Grains always “exist”
The runtime activates them as needed
They are deactivated automatically after an idle period or
when requested
Can control what happens on activation/deactivation
Comparison with normal actors:
Control creation, full life cycle, hierarchy
Handling Failure
No supervision hierarchies
Exceptions are thrown back to the caller
Grains on dead nodes are automatically reactivated
elsewhere by the runtime
Location Transparency
No actor path
Just a grain ID
Actors are allocated automatically to different nodes
Typically, you would not know where an actor lives
Forces you to think distributed first
Asynchrous Messaging
No need to declare a message class
Methods provide an abstraction
Grain methods must be asynchronous
Must return Task or Task<T>
Enforced by the runtime
Invocation patterns
Await: preserves order, affects throughput
Fire and forget: parallel (faster, no ordering)
Orleans is …
… runtime and programming model for building distributed
systems based on actor model
Built by eXtreme Computing Group in MSR in 2014
(https://www.microsoft.com/en-us/research/wp-
content/uploads/2016/02/Orleans-MSR-TR-2014-41.pdf)
Has been used internally (during last few years)
Open-sourced in 2015
built for *
Scalability
Availability
Reliablity
Routing Problems supported
Cluster Membership
Workload Distribution
Static
Distributed Consensus
Dynamic
Timeouts
Lifecycle
Co-location
10.0.0.1
10.0.0.2
10.0.0.5
10.0.0.8
DEMO
Azure Durable Entities
Azure Durable Functions
Write long-running orchestrations as a single function while
maintaining local state.
Simplify complex transactions and coordination (chaining,
etc.) Easily call a Function from another Function,
synchronously or asynchronously.
All of the above using code-only. No JSON schemas. No
graphical designer.
Generally available (v1). Supports multiple languages (C#,
JavaScript)
Durable Functions Scenarios
Orchestrator
Function
Activity
Function
Starter
Function
Activity
Function
Activity
Function
Components
Durable Entities
DEMO
Azure Digital Twins
Anatomy of a Digital Twins Solution
A Digital Twin instance
IoT Hub and Connected Devices
One or more client apps that connects with the DT Instance
Create and manage a fraph o twin instances
Extract insight from twin state
A set of Azure functions or other propessing resources for
custom processing
Downstream services fro long-term storage, bulk data
analutics, etc
Azure Digital Twins PaaS
Platform for developers to model the real world
Controlled using a rich set of REST APIs
And Azure Portal and CLI
C# SDK available for Public Preview
SDK for additional languages coming
Parser library for validation and “reflection” over DTDL
Open Modeling Language
Create custom domain models using «Digital Twins Definition
Language» (DTDL)
Model sdescribe twins in terms of
Telemetry
Properties
Commands
Relationships
Components
Models define semantic relationships to connect twins into a
knowledge graph
Models can specialize other twins using inheritance
Digital Twins Definition language is aligned with:
IoT Plug and Play
Time Series Insights data model
More defined rather that IoT Hub
New!
Simple interface example
The top level of any twin
description is called an
interface
At the top level the twin
description has a dnumber of
necessary fields:
@id
@type
Contents
@type
Name
Schema
@context
Live execution environment
Create a live execution environment from the DTDL models in
ADT
Abstraction from writing into a DB
Abstraction from hosting a twin in...a container, a function, an app
service
Twin instances and relationships form a live graph
representation of the environment
Use a rich event system to drive business logic and data
processing.
Extract insights from the live execution environment with a
powerful query API
Query using rich search conditions, including propertu values,
relationships, replationship properties, type information and more
DEMO
“my own actor”
Windows Azure Service Bus 101
Queues
brokered messaging communication model
components of an application don’t communicate directly, but
rather exchange messages via an intermediary queue
One-to-one, asynchronous, follows FIFO
Topics & Subscriptions
pub/sub messaging communication model
components of an application don’t communicate directly, but
rather exchange messages via an intermediary topic
one-to-many, can register multiple subscriptions to a topic, each
message sent to a topic is available for each subscription to
handle independently
Queues
Decouple sender and receiver
One or many senders.
One or many (competing)
receivers.
Load leveling Receiver is never
overloaded, process at its own
pace.
Temporal decoupling Allows taking
the receiver offline for servicing.
Load balancing Multiple receivers
compete for messages.
Sender Receiver
Sender
Receiver
Sender
Sender
Receiver
Topics & Subscriptions
Senders send to a topic
Receivers receive from
subscription
Each subscription has one
copy of the message.
Filters, Rules and Actions
Message distribution
Deliver the same message
to more than one client.
Subscribers can filter by
interest.
Message partitioning
Receiver get mutually
exclusive slices of the
message stream.
Sender
Receiver
Sender
Sender Receiver
F1
F2
Receiver
Features of Service Bus
Sessions
Ordering
Duplicate detection
DEMO
Conclusions
Conclusions
State is still bad
K8s help visualize that it can be not so bad
It’s an approach, not just a library
It is not yet common, so from a pure biz view, it can be risky
It can be a game changer in some areas
The various projects: Orleans
Pro
Towards full product with full Microsoft support
Integrated with modern .NET 6.x / .NET 7.x timeline
Can be hosted under App Service Plan
Cons
Towards full product with full Microsoft support...really?
No real success at the moment
Hosted under Container Apps?
The various projects: Durable Functions
Pro
Azure Function Success
Hosting in App Service Plan and on premise
Cons
Architecturally «slow» (event basis, not streaming basis)
Rigid persistence (table storage and just few providers)
The various projects: Azure Digital Twin
Pro
Azure strong IoT member
Big momentum
Cons
No on-edge product
No strong acceptance
The various projects: my own actor
Pro
Your actor, your success
Messaging syncronization...not so bad, not so difficult
Full control and adaptation
Service Bus is a really strong infrastructure
Cons
Your actor, your success...your work, your pains 
Lot of work, probably
Service Bus probably is not suitable for thousands of
subscriberspartitioning?
Thanks
Questions?
marcoparenzan marco_parenzan marcoparenzan

More Related Content

Similar to Developing Distributed Apps with Actor Model in Azure

Innovate2011 Keys to Building OSLC Integrations
Innovate2011 Keys to Building OSLC IntegrationsInnovate2011 Keys to Building OSLC Integrations
Innovate2011 Keys to Building OSLC IntegrationsSteve Speicher
 
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...Maarten Balliauw
 
Stateful patterns in Azure Functions
Stateful patterns in Azure FunctionsStateful patterns in Azure Functions
Stateful patterns in Azure FunctionsMassimo Bonanni
 
Elements of DDD with ASP.NET MVC & Entity Framework Code First
Elements of DDD with ASP.NET MVC & Entity Framework Code FirstElements of DDD with ASP.NET MVC & Entity Framework Code First
Elements of DDD with ASP.NET MVC & Entity Framework Code FirstEnea Gabriel
 
Building scalable and language-independent Java services using Apache Thrift ...
Building scalable and language-independent Java services using Apache Thrift ...Building scalable and language-independent Java services using Apache Thrift ...
Building scalable and language-independent Java services using Apache Thrift ...IndicThreads
 
Overview of VS2010 and .NET 4.0
Overview of VS2010 and .NET 4.0Overview of VS2010 and .NET 4.0
Overview of VS2010 and .NET 4.0Bruce Johnson
 
Building scalable and language independent java services using apache thrift
Building scalable and language independent java services using apache thriftBuilding scalable and language independent java services using apache thrift
Building scalable and language independent java services using apache thriftTalentica Software
 
Azure Service Fabric and the Actor Model: when did we forget Object Orientation?
Azure Service Fabric and the Actor Model: when did we forget Object Orientation?Azure Service Fabric and the Actor Model: when did we forget Object Orientation?
Azure Service Fabric and the Actor Model: when did we forget Object Orientation?João Pedro Martins
 
SoC Keynote:The State of the Art in Integration Technology
SoC Keynote:The State of the Art in Integration TechnologySoC Keynote:The State of the Art in Integration Technology
SoC Keynote:The State of the Art in Integration TechnologySrinath Perera
 
XebiCon'17 : AxonFramework @ SGCIB (our experience) : (CQRS, Eventsourcing, A...
XebiCon'17 : AxonFramework @ SGCIB (our experience) : (CQRS, Eventsourcing, A...XebiCon'17 : AxonFramework @ SGCIB (our experience) : (CQRS, Eventsourcing, A...
XebiCon'17 : AxonFramework @ SGCIB (our experience) : (CQRS, Eventsourcing, A...Publicis Sapient Engineering
 
PowerPoint
PowerPointPowerPoint
PowerPointVideoguy
 
ArcReady - Architecting For The Cloud
ArcReady - Architecting For The CloudArcReady - Architecting For The Cloud
ArcReady - Architecting For The CloudMicrosoft ArcReady
 
Eucalyptus: Open Source for Cloud Computing
Eucalyptus: Open Source for Cloud ComputingEucalyptus: Open Source for Cloud Computing
Eucalyptus: Open Source for Cloud Computingclive boulton
 
Linking Programming models between Grids, Web 2.0 and Multicore
Linking Programming models between Grids, Web 2.0 and Multicore Linking Programming models between Grids, Web 2.0 and Multicore
Linking Programming models between Grids, Web 2.0 and Multicore Geoffrey Fox
 
Arc Ready Cloud Computing
Arc Ready Cloud ComputingArc Ready Cloud Computing
Arc Ready Cloud ComputingPhilip Wheat
 
Software architectural patterns - A Quick Understanding Guide
Software architectural patterns - A Quick Understanding GuideSoftware architectural patterns - A Quick Understanding Guide
Software architectural patterns - A Quick Understanding GuideMohammed Fazuluddin
 
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...Bill Buchan
 
Crafted Design - LJC World Tour Mash Up 2014
Crafted Design - LJC World Tour Mash Up 2014Crafted Design - LJC World Tour Mash Up 2014
Crafted Design - LJC World Tour Mash Up 2014Sandro Mancuso
 

Similar to Developing Distributed Apps with Actor Model in Azure (20)

Innovate2011 Keys to Building OSLC Integrations
Innovate2011 Keys to Building OSLC IntegrationsInnovate2011 Keys to Building OSLC Integrations
Innovate2011 Keys to Building OSLC Integrations
 
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...
 
Stateful patterns in Azure Functions
Stateful patterns in Azure FunctionsStateful patterns in Azure Functions
Stateful patterns in Azure Functions
 
Interoperability
InteroperabilityInteroperability
Interoperability
 
Elements of DDD with ASP.NET MVC & Entity Framework Code First
Elements of DDD with ASP.NET MVC & Entity Framework Code FirstElements of DDD with ASP.NET MVC & Entity Framework Code First
Elements of DDD with ASP.NET MVC & Entity Framework Code First
 
Building scalable and language-independent Java services using Apache Thrift ...
Building scalable and language-independent Java services using Apache Thrift ...Building scalable and language-independent Java services using Apache Thrift ...
Building scalable and language-independent Java services using Apache Thrift ...
 
Overview of VS2010 and .NET 4.0
Overview of VS2010 and .NET 4.0Overview of VS2010 and .NET 4.0
Overview of VS2010 and .NET 4.0
 
Building scalable and language independent java services using apache thrift
Building scalable and language independent java services using apache thriftBuilding scalable and language independent java services using apache thrift
Building scalable and language independent java services using apache thrift
 
Azure Service Fabric and the Actor Model: when did we forget Object Orientation?
Azure Service Fabric and the Actor Model: when did we forget Object Orientation?Azure Service Fabric and the Actor Model: when did we forget Object Orientation?
Azure Service Fabric and the Actor Model: when did we forget Object Orientation?
 
SoC Keynote:The State of the Art in Integration Technology
SoC Keynote:The State of the Art in Integration TechnologySoC Keynote:The State of the Art in Integration Technology
SoC Keynote:The State of the Art in Integration Technology
 
XebiCon'17 : AxonFramework @ SGCIB (our experience) : (CQRS, Eventsourcing, A...
XebiCon'17 : AxonFramework @ SGCIB (our experience) : (CQRS, Eventsourcing, A...XebiCon'17 : AxonFramework @ SGCIB (our experience) : (CQRS, Eventsourcing, A...
XebiCon'17 : AxonFramework @ SGCIB (our experience) : (CQRS, Eventsourcing, A...
 
PowerPoint
PowerPointPowerPoint
PowerPoint
 
ArcReady - Architecting For The Cloud
ArcReady - Architecting For The CloudArcReady - Architecting For The Cloud
ArcReady - Architecting For The Cloud
 
Eucalyptus: Open Source for Cloud Computing
Eucalyptus: Open Source for Cloud ComputingEucalyptus: Open Source for Cloud Computing
Eucalyptus: Open Source for Cloud Computing
 
Linking Programming models between Grids, Web 2.0 and Multicore
Linking Programming models between Grids, Web 2.0 and Multicore Linking Programming models between Grids, Web 2.0 and Multicore
Linking Programming models between Grids, Web 2.0 and Multicore
 
Arc Ready Cloud Computing
Arc Ready Cloud ComputingArc Ready Cloud Computing
Arc Ready Cloud Computing
 
Software architectural patterns - A Quick Understanding Guide
Software architectural patterns - A Quick Understanding GuideSoftware architectural patterns - A Quick Understanding Guide
Software architectural patterns - A Quick Understanding Guide
 
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
 
.NET presentation
.NET presentation.NET presentation
.NET presentation
 
Crafted Design - LJC World Tour Mash Up 2014
Crafted Design - LJC World Tour Mash Up 2014Crafted Design - LJC World Tour Mash Up 2014
Crafted Design - LJC World Tour Mash Up 2014
 

More from Marco Parenzan

Azure IoT Central per lo SCADA engineer
Azure IoT Central per lo SCADA engineerAzure IoT Central per lo SCADA engineer
Azure IoT Central per lo SCADA engineerMarco Parenzan
 
Static abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptx
Static abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptxStatic abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptx
Static abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptxMarco Parenzan
 
Azure Synapse Analytics for your IoT Solutions
Azure Synapse Analytics for your IoT SolutionsAzure Synapse Analytics for your IoT Solutions
Azure Synapse Analytics for your IoT SolutionsMarco Parenzan
 
Power BI Streaming Data Flow e Azure IoT Central
Power BI Streaming Data Flow e Azure IoT Central Power BI Streaming Data Flow e Azure IoT Central
Power BI Streaming Data Flow e Azure IoT Central Marco Parenzan
 
Power BI Streaming Data Flow e Azure IoT Central
Power BI Streaming Data Flow e Azure IoT CentralPower BI Streaming Data Flow e Azure IoT Central
Power BI Streaming Data Flow e Azure IoT CentralMarco Parenzan
 
Power BI Streaming Data Flow e Azure IoT Central
Power BI Streaming Data Flow e Azure IoT CentralPower BI Streaming Data Flow e Azure IoT Central
Power BI Streaming Data Flow e Azure IoT CentralMarco Parenzan
 
Math with .NET for you and Azure
Math with .NET for you and AzureMath with .NET for you and Azure
Math with .NET for you and AzureMarco Parenzan
 
Power BI data flow and Azure IoT Central
Power BI data flow and Azure IoT CentralPower BI data flow and Azure IoT Central
Power BI data flow and Azure IoT CentralMarco Parenzan
 
.net for fun: write a Christmas videogame
.net for fun: write a Christmas videogame.net for fun: write a Christmas videogame
.net for fun: write a Christmas videogameMarco Parenzan
 
Building IoT infrastructure on edge with .net, Raspberry PI and ESP32 to conn...
Building IoT infrastructure on edge with .net, Raspberry PI and ESP32 to conn...Building IoT infrastructure on edge with .net, Raspberry PI and ESP32 to conn...
Building IoT infrastructure on edge with .net, Raspberry PI and ESP32 to conn...Marco Parenzan
 
Anomaly Detection with Azure and .NET
Anomaly Detection with Azure and .NETAnomaly Detection with Azure and .NET
Anomaly Detection with Azure and .NETMarco Parenzan
 
Deploy Microsoft Azure Data Solutions
Deploy Microsoft Azure Data SolutionsDeploy Microsoft Azure Data Solutions
Deploy Microsoft Azure Data SolutionsMarco Parenzan
 
Deep Dive Time Series Anomaly Detection in Azure with dotnet
Deep Dive Time Series Anomaly Detection in Azure with dotnetDeep Dive Time Series Anomaly Detection in Azure with dotnet
Deep Dive Time Series Anomaly Detection in Azure with dotnetMarco Parenzan
 
Anomaly Detection with Azure and .net
Anomaly Detection with Azure and .netAnomaly Detection with Azure and .net
Anomaly Detection with Azure and .netMarco Parenzan
 
Code Generation for Azure with .net
Code Generation for Azure with .netCode Generation for Azure with .net
Code Generation for Azure with .netMarco Parenzan
 
Running Kafka and Spark on Raspberry PI with Azure and some .net magic
Running Kafka and Spark on Raspberry PI with Azure and some .net magicRunning Kafka and Spark on Raspberry PI with Azure and some .net magic
Running Kafka and Spark on Raspberry PI with Azure and some .net magicMarco Parenzan
 
Time Series Anomaly Detection with Azure and .NETT
Time Series Anomaly Detection with Azure and .NETTTime Series Anomaly Detection with Azure and .NETT
Time Series Anomaly Detection with Azure and .NETTMarco Parenzan
 
Code Generation for Azure with .net
Code Generation for Azure with .netCode Generation for Azure with .net
Code Generation for Azure with .netMarco Parenzan
 

More from Marco Parenzan (20)

Azure IoT Central per lo SCADA engineer
Azure IoT Central per lo SCADA engineerAzure IoT Central per lo SCADA engineer
Azure IoT Central per lo SCADA engineer
 
Azure Hybrid @ Home
Azure Hybrid @ HomeAzure Hybrid @ Home
Azure Hybrid @ Home
 
Static abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptx
Static abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptxStatic abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptx
Static abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptx
 
Azure Synapse Analytics for your IoT Solutions
Azure Synapse Analytics for your IoT SolutionsAzure Synapse Analytics for your IoT Solutions
Azure Synapse Analytics for your IoT Solutions
 
Power BI Streaming Data Flow e Azure IoT Central
Power BI Streaming Data Flow e Azure IoT Central Power BI Streaming Data Flow e Azure IoT Central
Power BI Streaming Data Flow e Azure IoT Central
 
Power BI Streaming Data Flow e Azure IoT Central
Power BI Streaming Data Flow e Azure IoT CentralPower BI Streaming Data Flow e Azure IoT Central
Power BI Streaming Data Flow e Azure IoT Central
 
Power BI Streaming Data Flow e Azure IoT Central
Power BI Streaming Data Flow e Azure IoT CentralPower BI Streaming Data Flow e Azure IoT Central
Power BI Streaming Data Flow e Azure IoT Central
 
Math with .NET for you and Azure
Math with .NET for you and AzureMath with .NET for you and Azure
Math with .NET for you and Azure
 
Power BI data flow and Azure IoT Central
Power BI data flow and Azure IoT CentralPower BI data flow and Azure IoT Central
Power BI data flow and Azure IoT Central
 
.net for fun: write a Christmas videogame
.net for fun: write a Christmas videogame.net for fun: write a Christmas videogame
.net for fun: write a Christmas videogame
 
Building IoT infrastructure on edge with .net, Raspberry PI and ESP32 to conn...
Building IoT infrastructure on edge with .net, Raspberry PI and ESP32 to conn...Building IoT infrastructure on edge with .net, Raspberry PI and ESP32 to conn...
Building IoT infrastructure on edge with .net, Raspberry PI and ESP32 to conn...
 
Anomaly Detection with Azure and .NET
Anomaly Detection with Azure and .NETAnomaly Detection with Azure and .NET
Anomaly Detection with Azure and .NET
 
Deploy Microsoft Azure Data Solutions
Deploy Microsoft Azure Data SolutionsDeploy Microsoft Azure Data Solutions
Deploy Microsoft Azure Data Solutions
 
Deep Dive Time Series Anomaly Detection in Azure with dotnet
Deep Dive Time Series Anomaly Detection in Azure with dotnetDeep Dive Time Series Anomaly Detection in Azure with dotnet
Deep Dive Time Series Anomaly Detection in Azure with dotnet
 
Azure IoT Central
Azure IoT CentralAzure IoT Central
Azure IoT Central
 
Anomaly Detection with Azure and .net
Anomaly Detection with Azure and .netAnomaly Detection with Azure and .net
Anomaly Detection with Azure and .net
 
Code Generation for Azure with .net
Code Generation for Azure with .netCode Generation for Azure with .net
Code Generation for Azure with .net
 
Running Kafka and Spark on Raspberry PI with Azure and some .net magic
Running Kafka and Spark on Raspberry PI with Azure and some .net magicRunning Kafka and Spark on Raspberry PI with Azure and some .net magic
Running Kafka and Spark on Raspberry PI with Azure and some .net magic
 
Time Series Anomaly Detection with Azure and .NETT
Time Series Anomaly Detection with Azure and .NETTTime Series Anomaly Detection with Azure and .NETT
Time Series Anomaly Detection with Azure and .NETT
 
Code Generation for Azure with .net
Code Generation for Azure with .netCode Generation for Azure with .net
Code Generation for Azure with .net
 

Recently uploaded

Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...OnePlan Solutions
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencessuser9e7c64
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITmanoharjgpsolutions
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptxVinzoCenzo
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsJean Silva
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldRoberto Pérez Alcolea
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxRTS corp
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolsosttopstonverter
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfRTS corp
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...Bert Jan Schrijver
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdfAndrey Devyatkin
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonApplitools
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorTier1 app
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identityteam-WIBU
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 

Recently uploaded (20)

Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conference
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh IT
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptx
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero results
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository world
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration tools
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryError
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identity
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 

Developing Distributed Apps with Actor Model in Azure

  • 1. 1 TOPIC Developing Actors in Azure with .NET Marco Parenzan
  • 3. Marco Parenzan Senior Solution Architect @ beanTech/Smart Factory 1nn0va Community Lead (Pordenone) Microsoft Azure MVP Profiles Linkedin: https://www.linkedin.com/in/marcoparenzan/ Slideshare: https://www.slideshare.net/marco.parenzan GitHub: https://github.com/marcoparenzan
  • 4. 4 TOPIC Developing Actors in Azure with .NET Marco Parenzan
  • 5. Agenda The need for a state What is an Actor? Already players in the Actor’s arena (really?) Many ways to create actors .net Orleans Azure Durable Entities Azure Digital Twins “my own actor”
  • 6. The need for a state Scaling 3-tier architecture (statelessstateful) Data stream processing Sampling Aggregation IoT GPS Tracker (RFID, inventory, cars) Counters (running total) Sensor data Service Service Service Stateless Services
  • 7. My own problem «Light» time window aggregation Redis is good but not enough Concurrency problem is «probabilistically» minimized, but not solved I worked on it about three years ago: https://www.slideshare.net/marco.parenzan/stateful-stream- processing-of-iiot-events-with-c-and-containers Evaluate runtime expressions Mature for enterprise grade «scripting languages» Heavy for stateless approach I’m still working on it: https://www.slideshare.net/marco.parenzan/math-with-net-for- you-and-azure
  • 9. shared state concurrency, locks, and all that jazz Stateful Services
  • 10. What is an Actor? The actor model in computer science is a mathematical model of concurrent computation that treats actor as the universal primitive of concurrent computation. In response to a message it receives, an actor can: make local decisions, create more actors, send more messages, and determine how to respond to the next message received. Actors may modify their own private state, but can only affect each other indirectly through messaging (removing the need for lock-based synchronization). From: https://en.wikipedia.org/wiki/Actor_model
  • 11. Fundamental concepts The actor model adopts the philosophy that everything is an actor. This is similar to the everything is an object philosophy used by some object-oriented programming languages. An actor is a computational entity that, in response to a message it receives, can concurrently: send a finite number of messages to other actors; create a finite number of new actors; designate the behavior to be used for the next message it receives.
  • 13. Actor Model Single threaded Not per actor, but thread pool One message at a time (internal message queue) No data sharing Message passing Actor Single Thread Internal State
  • 15. Points Always expressed as theorydifficult Affinity with microservices it’s own state Affinity with DDD bounded contexts (messaging to get out the others) aggregate roots (responsible for its own work)
  • 16. Already players in the Actor’s arena (really?) Sure! Erlang Azure Service Fabric Akka.netThe «best»...but really the winner? DAPRMicroservices in K8s (Actor is always one scenario) What’s happened Orleans is now .NET Foundation project since 2021 (https://dotnetfoundation.org/projects/spotlight?project=Orleans) Alignment with with ASP.NET Core development model
  • 18. Grains and Silos Grain: a virtual actor Silo: a server instance, holding many grains Turn: processing a message Activation: single living instance of a grain
  • 19. Activation and Life Cycle Grains always “exist” The runtime activates them as needed They are deactivated automatically after an idle period or when requested Can control what happens on activation/deactivation Comparison with normal actors: Control creation, full life cycle, hierarchy
  • 20. Handling Failure No supervision hierarchies Exceptions are thrown back to the caller Grains on dead nodes are automatically reactivated elsewhere by the runtime
  • 21. Location Transparency No actor path Just a grain ID Actors are allocated automatically to different nodes Typically, you would not know where an actor lives Forces you to think distributed first
  • 22. Asynchrous Messaging No need to declare a message class Methods provide an abstraction Grain methods must be asynchronous Must return Task or Task<T> Enforced by the runtime Invocation patterns Await: preserves order, affects throughput Fire and forget: parallel (faster, no ordering)
  • 23. Orleans is … … runtime and programming model for building distributed systems based on actor model Built by eXtreme Computing Group in MSR in 2014 (https://www.microsoft.com/en-us/research/wp- content/uploads/2016/02/Orleans-MSR-TR-2014-41.pdf) Has been used internally (during last few years) Open-sourced in 2015 built for * Scalability Availability Reliablity
  • 24. Routing Problems supported Cluster Membership Workload Distribution Static Distributed Consensus Dynamic Timeouts Lifecycle Co-location 10.0.0.1 10.0.0.2 10.0.0.5 10.0.0.8
  • 25. DEMO
  • 26.
  • 27.
  • 29. Azure Durable Functions Write long-running orchestrations as a single function while maintaining local state. Simplify complex transactions and coordination (chaining, etc.) Easily call a Function from another Function, synchronously or asynchronously. All of the above using code-only. No JSON schemas. No graphical designer. Generally available (v1). Supports multiple languages (C#, JavaScript)
  • 33. DEMO
  • 35. Anatomy of a Digital Twins Solution A Digital Twin instance IoT Hub and Connected Devices One or more client apps that connects with the DT Instance Create and manage a fraph o twin instances Extract insight from twin state A set of Azure functions or other propessing resources for custom processing Downstream services fro long-term storage, bulk data analutics, etc
  • 36. Azure Digital Twins PaaS Platform for developers to model the real world Controlled using a rich set of REST APIs And Azure Portal and CLI C# SDK available for Public Preview SDK for additional languages coming Parser library for validation and “reflection” over DTDL
  • 37. Open Modeling Language Create custom domain models using «Digital Twins Definition Language» (DTDL) Model sdescribe twins in terms of Telemetry Properties Commands Relationships Components Models define semantic relationships to connect twins into a knowledge graph Models can specialize other twins using inheritance Digital Twins Definition language is aligned with: IoT Plug and Play Time Series Insights data model More defined rather that IoT Hub New!
  • 38. Simple interface example The top level of any twin description is called an interface At the top level the twin description has a dnumber of necessary fields: @id @type Contents @type Name Schema @context
  • 39. Live execution environment Create a live execution environment from the DTDL models in ADT Abstraction from writing into a DB Abstraction from hosting a twin in...a container, a function, an app service Twin instances and relationships form a live graph representation of the environment Use a rich event system to drive business logic and data processing. Extract insights from the live execution environment with a powerful query API Query using rich search conditions, including propertu values, relationships, replationship properties, type information and more
  • 40. DEMO
  • 42. Windows Azure Service Bus 101 Queues brokered messaging communication model components of an application don’t communicate directly, but rather exchange messages via an intermediary queue One-to-one, asynchronous, follows FIFO Topics & Subscriptions pub/sub messaging communication model components of an application don’t communicate directly, but rather exchange messages via an intermediary topic one-to-many, can register multiple subscriptions to a topic, each message sent to a topic is available for each subscription to handle independently
  • 43. Queues Decouple sender and receiver One or many senders. One or many (competing) receivers. Load leveling Receiver is never overloaded, process at its own pace. Temporal decoupling Allows taking the receiver offline for servicing. Load balancing Multiple receivers compete for messages. Sender Receiver Sender Receiver Sender Sender Receiver
  • 44. Topics & Subscriptions Senders send to a topic Receivers receive from subscription Each subscription has one copy of the message. Filters, Rules and Actions Message distribution Deliver the same message to more than one client. Subscribers can filter by interest. Message partitioning Receiver get mutually exclusive slices of the message stream. Sender Receiver Sender Sender Receiver F1 F2 Receiver
  • 45. Features of Service Bus Sessions Ordering Duplicate detection
  • 46. DEMO
  • 48. Conclusions State is still bad K8s help visualize that it can be not so bad It’s an approach, not just a library It is not yet common, so from a pure biz view, it can be risky It can be a game changer in some areas
  • 49. The various projects: Orleans Pro Towards full product with full Microsoft support Integrated with modern .NET 6.x / .NET 7.x timeline Can be hosted under App Service Plan Cons Towards full product with full Microsoft support...really? No real success at the moment Hosted under Container Apps?
  • 50. The various projects: Durable Functions Pro Azure Function Success Hosting in App Service Plan and on premise Cons Architecturally «slow» (event basis, not streaming basis) Rigid persistence (table storage and just few providers)
  • 51. The various projects: Azure Digital Twin Pro Azure strong IoT member Big momentum Cons No on-edge product No strong acceptance
  • 52. The various projects: my own actor Pro Your actor, your success Messaging syncronization...not so bad, not so difficult Full control and adaptation Service Bus is a really strong infrastructure Cons Your actor, your success...your work, your pains  Lot of work, probably Service Bus probably is not suitable for thousands of subscriberspartitioning?

Editor's Notes

  1. Imagine a scenario where I have to take the output of a Function and use it as the input to call another Function. I’ll have to coordinate the chaining manually. If I have to have a function that takes some sort of event and then parallelizes it into multiple Functions, I can still do that but how will I know when all Functions have finished executing so I can aggregate the results and move on. What if I had to listen on multiple events and aggregate their outcome to determine which specific job or function to run in my application. What if I wanted to do some kind of extended monitoring on an endpoint? For example, if I were to monitor the temperature of a remote machine and take action x if the temperature were lower than a certain threshold, else do y or run job y. What if I have an API or endpoint that was running for a long time? I know Functions are short-lived but sometimes you guys put some serious load on them. Could there be a mechanism to provide status of the execution back to the client so they’re not left hanging? And lastly, what if I wanted to get some sort of human interaction in there? For example, if I am to do some sort of 2FA in the middle of my function execution but also don’t want to wait forever because sometimes people take forever to reply especially when the texts are automated. Today, I’m going to be talking about some of these problems – how you can approach them in regular FaaS? And how they can be simplified with the technology of Durable Functions.
  2. https://www.youtube.com/watch?v=aHue7XuNYZA