Microsoft’s Open Source Dapr Could Help Developers Build Agnostic Microservice Applications
Upon first reading about Dapr, the newly open-source project released by Microsoft this week, you might be tempted to think it is yet another service mesh. Instead, Dapr is described in a blog post as “an open source, 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.”
While the project uses the familiar sidecar architecture employed by the Envoy proxy in its Istio service mesh implementation, Gabe Monroy, director of program management for Azure explained in an email interview that Dapr operates as a sidecar, but provides a completely different functionality than a service mesh.
“Dapr loosely translates to Distributed Application Runtime. Unlike a service mesh, which is focused on networking concerns,” writes Monroy, “Dapr is focused on providing building blocks that make it easier for developers to build microservices. Dapr is developer-centric versus infrastructure-centric.”
At launch, those building blocks include service invocation, state management, publish and subscribe messaging between services, event driven resource bindings, virtual actors, and distributed tracing between services.
With these building blocks, developers can build microservice applications without having to change their code, both building new applications and transitioning existing code to a microservice architecture.
“This side-car pattern used by Dapr is similar to what you see with service mesh architecture, where a local proxy is used to route requests. However in the case of Dapr, the side-cars are used to enable integration of microservice building blocks at run time versus at compile time. This allows Dapr to be used with existing and legacy code, through a standard HTTP/gRPC interface,” writes Monroy. “Dapr is designed to easily integrate with existing and legacy code through the use of sidecar containers and standard HTTP APIs that can be integrated into their existing codebases. This makes it possible for enterprise developers to experience the benefits of microservices development without having to rewrite their applications.”
In explanation of its building block functionality, the blog post offers the example of a developer building an application using the Azure Functions runtime and desiring a pub/sub pattern to send messages between the services — a feature not currently provided by Azure Functions. This is precisely where Dapr not only provides that functionality, but also enables developers to “dynamically choose different implementations for how the messages are sent, without changing any code.”
A key feature of Dapr is that it is completely platform and language agnostic, meaning that it can run on any platform, any Kubernetes deployment, in the cloud or on-premise, and even on any IoT device. All of this means that developers can use the language, platform, framework, etc. of their choice in building a microservices application, all while remaining free from handling low-level primitives such as threading, concurrency control, partitioning and scaling.
With Microsoft contributing the code for Dapr’s alpha release, Monroy writes that “We expect this to be driven by the developer community as an open source project. We welcome the developer community to shape and harden this technology, and help expand the set of building blocks we delivered in the initial release.”
According to the project roadmap, TypeScript, C#, Scala, Ruby and Rust are slated for SDK development in the near future, with distributed-lock, leader election, retry and circuit-breaking mechanisms, and service registries all under consideration as well. The GitHub repository for Dapr currently highlights that the project is in alpha and therefore not expected to be used for production workloads until its 1.0 stable release.
This week, the company also released the Open Application Model, a set of specifications for running applications on Kubernetes.