Microsoft's Distributed Application Runtime (Dapr) Debuts for Microservices
Microsoft's open source distributed application runtime, Dapr, is now production ready in version 1.0, easing microservices development on-premises, on the edge or in the cloud.
Dapr is intended to manage the many challenges inherent to developing microservices applications, which typically are event-driven, firing off code executions in response to events like telemetry triggers, user interactions and so on. Such applications can draw on resources from all over the place, invocating other microservices (which in turn may leverage others), managing state, making calls to data stores, handling identity functionality and more.
The idea is to let developers focus on building their own applications without having to worry about those distributed development challenges such as recovering state after failures, managing secrets, discovering and calling other microservices, managing security, etc.
While abstracting away the implementation details of all those interactions, developers can use any programming language, any development framework, running anywhere, Microsoft says.
Dapr uses core "bulding blocks" providing specific best practices functionality for different use cases. Dapr, first announced back in October 2019, features these building blocks:
- Service Invocation: Using service invocation, your application can reliably and securely communicate with other applications using the standard gRPC or HTTP protocols.
- State Management: Using state management, your application can store data as key/value pairs in the supported state stores. The state manager can be used with different state stores housed in popular offerings like Redis, MongoDB, and Azure Cosmos DB, remaining agnostic to any specific implementation so developers can swap them out without changing code.
- Publish & Subscribe: The publish/subscribe pattern allows microservices to communicate with each other using messages. Publishing events and subscribing to topics between services enables event-driven architectures to simplify horizontal scalability and make them resilient to failure.
Securing Secrets: To make it easier for developers everywhere to consume application secrets, Dapr has a dedicated secrets building block API that allows developers to get secrets from a secret store.
- Bindings: Using bindings, you can trigger your app with events coming in from external systems, or interface with external systems. Resource bindings and triggers build further on event-driven architectures for scale and resiliency by receiving and sending events to and from any external resources such as databases, queues, file systems, blob stores, webhooks, etc. For example, your code can be triggered by a message on an Azure EventHub service and write data to Azure CosmosDB.
- Actors: The actor pattern describes actors as the lowest-level “unit of computation.” You write code in a self-contained unit (called an actor) that receives messages and processes them one at a time, without any kind of concurrency or threading. It's a pattern for stateless and stateful objects that make concurrency simple with method and state encapsulation. Dapr provides many capabilities in its virtual actor runtime including concurrency, state, life-cycle management for actor activation/deactivation and timers and reminders to wake up actors.
In shipping v1., the dev team drew upon community feedback to focus on performance, security, High Availability (HA) and conformance. The initial release installs Kubernetes as a production environment, with the super-popular container orchestration system being deeply integrated into Dapr's control plane and its "sidecar architecture."
Regarding the latter, Microsoft says Dapr runs alongside your application like a sidecar, whether on a local dev box, edge device or in the cloud, providing functionality as needed. For example, when an app is hosted in Kubernetes, Dapr runs as another container in the application's pod, scaling along with the app.
As far as developer tooling, Dapr 1.0 is integrated with several frameworks including ASP.NET Core, Java Spring Boot, Azure Functions and Logic Apps. Microsoft says it sees this trend continuing with more open source frameworks like Django, Nodejs and Kyma, for potential examples.
Developers can work with Visual Studio Code integrations with Dapr, IntelliJ or GitHub Codespaces.
Going forward, Microsoft said the v1.0 release lays the foundation for essential building blocks for cloud native development.
"Being community driven means that the community will set the project's priorities in future releases and many of these have already been up voted on," the company said in a Feb. 17 announcement post. "For example, highlights to enhance the existing building blocks include having the ability to query and filter multiple values in state management with OData. In pub/sub, supporting CloudEvents v1.0 filtering to filter out events that are of interest to the subscriber based on message content. In observability, providing an API for tracing events from the application, preventing you from having to bind to specific monitoring libraries and enabling actors to subscribe to pub/sub events directly opens up a wealth of event driven scenarios."
You can learn more at:
David Ramel is an editor and writer for Converge360.