0% found this document useful (0 votes)
5 views

Dapr Overview

DAPR overview

Uploaded by

roger gurgur
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Dapr Overview

DAPR overview

Uploaded by

roger gurgur
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

Distributed Application Runtime

Being asked to develop resilient, scalable,


State of microservice-based apps
Enterprise They write in many languages
Developers They want to leverage existing code
Distributed app development
• Developer write applications that interacts with other services
• Increasingly polyglot with a microservice architecture
E-commerce application built with stateless and stateful services

Email service Inventory service

Payment service Recommendation service

Internet

CosmosDB
Frontend service Cart service Checkout service
Http

Kafka message
Shipping service
Why Dapr?

Dapr is a portable, event-driven runtime that makes it easy for


developers to build resilient, microservice stateless and stateful
applications that run on the cloud and edge.
What is holding back
microservices development?

Frequently need to Runtimes have narrow Runtimes don’t have


incrementally migrate from language support with tightly composable and incrementally
existing and legacy code controlled feature sets adoptable equivalents that can
run anywhere
What problems does dapr solve?
Problem Solution
SDKs each have different capabilities Microservice building blocks that can be used with
any SDK or language
Calling service endpoints is dependent on the hosting Standard service method invocation API with http or
platform gRPC

Stateful microservices are hard especially store Simple state management using key/value pairs with
configuration, consistency and concurrency pluggable state stores
Events from any external system need to trigger a Open component model enables bindings to be
service developed for any external system to send events
Publishing and subscribing to events is dependent on Standard API with pluggable providers makes the
compiling with specific libraries code portable for sending and receiving events

© Microsoft Corporation
Introducing Dapr
A portable, event-driven, serverless runtime for building
distributed applications across cloud and edge

Make it easy for developers to create microservice


Microservice Building Blocks applications without being an expert in distributed
systems, including migrating existing code

Developer first, standard APIs used from any


Sidecar Architecture programming language or framework

Runs on multiple environments for cloud, on-


Cloud + Edge prem, and small-edge including any Kubernetes
Sidecar architecture

Standard APIs accessed over http/gRPC protocols from user service code
e.g. http://localhost:3500/v1.0/invoke/myapp/method/neworder

Dapr runs as local “side-car library” dynamically loaded at runtime for each service

Service-to-service State
invocation management

Publish and subscribe


HTTP/gRPC

Application
code API Resource
Actors
bindings & triggers

Distributed tracing Extensible…


Dapr: Build apps using any language with any framework
Microservice application
Services written in

Any code or
.NET Core Functions
framework…

HTTP/gRPC APIs

Service-to- Resource
State Publish and Distributed
service bindings & Actors Extensible…
management subscribe tracing
invocation triggers

Any cloud or edge infrastructure


Dapr Self-hosted

Resource bindings
Scanning for events

Application

Dapr API Dapr API


Service Service
code A code B

Messaging
Publish and
subscribe
Load and
save state
State stores
Dapr Kubernetes-hosted
Deploys and
manages Dapr

Components
Pod Pod Pod
CONTAINER CONTAINER CONTAINER Component
Input/output bindings
management

Placement Sidecar Injector Operator

Updates actor Injects Dapr Update component


partition placement runtime changes to runtime

State stores
CONTAINER Pod CONTAINER

Dapr API
HTTP or gRPC Service code
Sidecar

Publish and
Use components subscribe

Any cloud or edge infrastructure


Microservice Building Blocks

State Management Service Invocation & Fault Handling Resource Bindings


Create long running, stateless Perform direct, secure, service-to- Trigger code through events from a
and stateful services service method calls large array of input and output
bindings to external resources
including databases and queues

Publish & Subscribe Actors Distributed Tracing & Diagnostics


Secure, scalable messaging Encapsulate code and data in See and measure the message calls
between services reusable actor objects as a common across components and networked
microservices design pattern services
State management
GET
http://localhost:3500/v1.0/state/planet

{
"name": "Tatooine"
} key Value
myApp-weapon "DeathStar"

App myApp-planet {
“myApp” "name": "Tatooine"
POST }
http://localhost:3500/v1.0/state
State store of your choice
[{
"key": "weapon",
"value": "DeathStar"
}, {
"key": "planet",
"value": {
"name": "Tatooine"
}
}]
Service Invocation
POST
http://localhost:3500/v1.0/invoke/cart/method/checkout

{
"user":"johndoe",
"cart":"0001"
}

“frontend”

“cart”
POST
http://10.0.0.2:8000/checkout

{
"user":"johndoe",
"cart":"0001"
}
DEMO
Dapr Invocation and
State Management
-- Redis
-- Cosmos
Output bindings
Redis

Event Hubs

Event
CosmosDB
Kafka
Redis
Hubs
SQS
DynamoDB
App
POST
http://localhost:3500/v1.0/bindings/inventory

{ CosmosDB
"data":
{
"sku":"v100",
"quantity":"50"
}
} Kafka

SQS
Input bindings

GET/POST
http://localhost:8000/trigger
Redis
{
"user":"johndoe"
}
Event Hubs

Event Kafka
Redis
Hubs
SQS
App
Kafka

SQS
Resource Bindings
 Dapr enable events to be sent and received from specific resources for any cloud
provider
 Examples: Azure EventHubs, AWS SNS, Google storage
Publishing & Subscribing
POST
http://10.0.0.4:8004/order

POST
http://localhost:3500/v1.0/publish/ “email”

"topic":"order",
"data":{
"user":"johndoe",
"item":"ZeroDay" "data":{
}, POST "user":"johndoe",
http://10.0.0.5:8005/order "item":"ZeroDay"
}

“cart” “shipping”

Publish Subscribe
Actors
 Actor pattern is good for solutions involving small, independent units of state and logic
 Actor runtime which provides concurrency, activation, deactivation, timers, reminders,
and partitioning
 Standard API
http://localhost:3500/v1.0/actors/<actorType>/<actorId>/method/<method>

Invoke the getData method on myactor with id=50

Invoke the ProcessData method on myactor with id=50, providing the value 5
Virtual Actors
with Dapr Video Game
Enemy
Stateful, objects of
storage and compute
Host/Pod
Dapr Actor Features:
• Distribution & failover
• Turn-based concurrency
• State management
• Timers
• Reminders
Host/Pod
Virtual Actors with Dapr POST
http://10.0.0.6:6004/update
Pod X

{ Actor A
“speed":“1"
}

POST
http://localhost:3500/v1.0/actors/MyActors/A/method/update Actor B

{
“speed":“1"
}
Invoke
Actor Pod Y
App
Actor C

Get Actor
Location Actor D

Placement
Service
Virtual Actors with Dapr Pod X

Actor A

POST
http://localhost:3500/v1.0/actors/MyActors/C/method/updateName Actor B

{
“speed":“3"
}
Invoke
Actor Pod Y
App
Actor C

Allocate
POST
http://10.0.0.7:6005/update
Get Actor
Location { Actor D
“speed":“3"
Placement }
Service
Dapr developer frameworks
Distributed Tracing & Diagnostics

Dapr Dapr

App Tracing Tracing App


Middleware Middleware

Tracing
Backend
Distributed Tracing and Diagnostics App Insights

Datadog

Instana
App
“frontend”

Jaeger

+App
Prometheus
many
Datadog
SignalFX
Insights
Instana
Jaeger
more

SignalFX

App Prometheus
“backend”

+ many more
Customer: Bosch IoT System Connector project
Learn more
https://github.com/dapr/dapr

You might also like