dapr - Distributed Application Runtime

dapr - Distributed Application Runtime

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 and embraces the diversity of languages and developer frameworks.

Today we are experiencing a wave of cloud adoption. Developers are comfortable with web + database application architectures (for example classic 3-tier designs) but not with microservice application architectures which are inherently distributed. It’s hard to become a distributed systems expert, nor should you have to. Developers want to focus on business logic, while leaning on the platforms to imbue their applications with scale, resiliency, maintainability, elasticity and the other attributes of cloud-native architectures.

This is where Dapr comes in. Dapr codifies the best practices for building microservice applications into open, independent, building blocks that enable you to build portable applications with the language and framework of your choice. Each building block is completely independent and you can use one, some, or all of them in your application.

In addition Dapr is platform agnostic meaning you can run your applications locally, on any Kubernetes cluster, and other hosting environments that Dapr integrates with. This enables you to build microservice applications that can run on the cloud and edge.

Using Dapr you can easily build microservice applications using any language, any framework, and run them anywhere.

Core concepts

  • Building blocks are a collection of components that implement distributed system capabilities, such as pub/sub, state management, resource bindings, and distributed tracing.
  • Components encapsulate the implementation for a building block API. Example implementations for the state building block may include Redis, Azure Storage, Azure Cosmos DB, and AWS DynamoDB. Many of the components are pluggable so that one implementation can be swapped out for another.

CLOUD-NATIVE DEVELOPMENT:

Distributed App Challenges

  1. Hard to incrementally migrate from existing code to a microservices architecture.
  2. Many programming model runtimes have narrow language support and tightly controlled feature sets.
  3. Event-driven architectures and state handling are complicated making them difficult to scale.
  4. Many runtimes only target specific infrastructure platforms with limited code portability across clouds and edge.

WITH DAPR:

Streamlined Microservices

  1. Dapr enables developers using any language or framework to easily write microservices, providing industry best practices to solve distributed systems problems.
  2. Dapr provides consistency and portability through open APIs and extensible components that are community-driven.
  3. Dapr handles state, resource bindings and pub/sub messaging, which enable event-driven, resilient architectures that scale.
  4. Dapr is platform agnostic and runs on any infrastructure, including public clouds and edge devices with its open APIs.

Microservice building blocks for cloud and edge

There are many considerations when architecting microservices applications. Dapr provides best practices for common capabilities when building microservice applications that developers can use in a standard way and deploy to any environment. It does this by providing distributed system building blocks.

Each of these building blocks is independent, meaning that you can use one, some or all of them in your application. In this initial release of Dapr, the following building blocks are provided:

• Service invocation Resilient service-to-service invocation enables method calls, including retries, on remote services wherever they are located in the supported hosting environment.

• State Management With state management for storing key/value pairs, long running, highly available, stateful services can be easily written alongside stateless services in your application. The state store is pluggable and can include Azure CosmosDB, AWS DynamoDB or Redis among others.

• Publish and subscribe messaging between services Publishing events and subscribing to topics between services enables event-driven architectures to simplify horizontal scalability and make them resilient to failure. Dapr provides at least once message delivery guarantee.

• Event driven resource bindings Resource bindings with triggers builds further on event-driven architectures for scale and resiliency by receiving and sending events to and from any external resource such as databases, queues, file systems, etc.

•Distributed tracing between services Dapr supports distributed tracing to easily diagnose and observe inter-service calls in production using the W3C Trace Context standard.

•Actors A pattern for stateful and stateless objects that make concurrency simple with method and state encapsulation. Dapr provides many capabilities in its actor runtime including concurrency, state, life-cycle management for actor activation/deactivation and timers and reminders to wake-up actors.

The diagram below shows the distributed system building blocks provides by Dapr, exposed with standard APIs. These APIs can be used from any developer code over http or gRPC. Dapr integrates with any hosting platform, for example Kubernetes, to enable application portability including across cloud and edge.

No alt text provided for this image

Running Dapr on a local developer machine in Standalone mode

Dapr can be configured to run on your local developer machine in Standalone mode. Each running service has a Dapr runtime process which is configured to use state stores, pub/sub and binding components.

Running Dapr in Kubernetes mode

Dapr can be configured to run on any Kubernetes cluster. In Kubernetes the dapr-sidecar-injector and dapr-operator services provide first class integration to launch Dapr as a sidecar container in the same pod as the service and provides notifications of Dapr component updates provisioned into the cluster.

Post contents are from Dapr documentations. Further details can be found here.

To view or add a comment, sign in

More articles by Kedar Dixit

Others also viewed

Explore content categories