Softobiz Technologies India | Insights | Dapr: An Open-source Runtime to Build Powerful Microservice Applications
Product development

Dapr: An Open-source Runtime to Build Powerful Microservice Applications


Creating distributed applications using microservices is exciting but not easy. The microservice architecture has its own set of adversities such as limited portability between the cloud and Edge, tightly controlled feature sets, and limited language support in the programming runtime. All these things make it difficult to build distributed applications using microservices. 

To resolve this issue, Microsoft has announced the distributed application runtime (Dapr). It has prebuilt components which makes it easier for the developers to build portable microservice applications in any language or framework without going into the repetitive process. 

What is Dapr? 

Dapr is an open-source, portable, and event-driven runtime for building resilient stateless and stateful microservice applications on the cloud and the edge. It allows developers to easily build powerful applications by giving them access to many programming languages and developer frameworks. 

Structural Overview of Dapr 

Dapr Runtime 

You can install Dapr runtime in any machine capable of running the Docker engine – like a multi-node Kubernetes cluster or on a resource-constrained edge device like Raspberry Pi Zero. Also, the core runtime is containerized. This means you can deploy it on x86/ARM processors running on any operating system. 

Native Libraries and SDKs 

The distributed application runtime also uses language-specific SDKs for GO, JavaScript, Java, .NET, and Python. Doing so makes the open-source runtime easily accessible for different languages. These native libraries and SDKs are responsible for exposing Dapr block functionalities like saving state, creating an actor, or publishing an event through a typed, language API instead of calling the standard http/gRPC API. Hence, developers can use the language of their choice to write a combination of actors along with stateful and stateless functions. 

Dapr Building Block 

Dapr building blocks simplify the consumption of microservices by serving as the middle layer between internal and external service providers. They also separate external services from internal consumers. For example, you can switch from using Amazon DynamoDB to Azure CosmosDB without even changing a single line of code. 

All the building blocks of the distributed application runtime are exposed with the help of standard REST or gRPC endpoints. Also, since the distributed application runtime uses the sidecar pattern, you can leverage Dapr blocks to easily integrate the services running on Kubernetes. 

How does Dapr Work? 

The distributed application runtime contains a set of building blocks that you can access by standard HTTP or gRPC APIs. You can call these APIs from any programming language. These building blocks empower developers with the necessary languages, frameworks, or features. Each block is independent. This means you can use either all of the ones you want in your app. There are options to add new building blocks and contributing new components as well. 

Also, the distributed application runtime is platform agnostic. It means you can run your applications locally, on a Kubernetes cluster, or any other hosting environment. This way developers can build microservice applications capable of running on both the cloud and edge without having to change any code. 

Here is an example of how you can build applications on the Microservice architecture with any language or framework by calling Dapr building blocks over standard APIs: 

Key Dapr Features 

1. Easy to Setup 

Getting started with Dapr is easy because of its multi-platform support and easily accessible CLI. All you need is to install the distributed application runtime on your PC and you can start coding in just a few seconds. 

2. Language & Platform Agnostic 

Dapr is language agnostic. This means you can use it with any language. All you need is to leverage the SDK or make simple HTTP or gRPC calls. Apart from this, you can also run the distributed application runtime on any hosting environment from the local development environment and Kubernetes to public clouds like AWS, Azure, and GCP. 

3. Code Agnostic 

A massive ecosystem of more than 70 pluggable components makes it possible for developers to use Dapr with any kind of code and any hosting environment. It also makes the applications easily portable. 

4. Open Source 

Dapr is an open-source project. This means you have access to a community of contributors worldwide. Since the fixes, features, and issues come from developers with diverse backgrounds – you can expect great support. 

5. Secure 

Microsoft has built Dapr keeping security in mind. With strong features like mutual authentication TLS (mTLS), the distributed application runtimeensures you no longer must worry about security.   

Apart from this, the Dapr sidecar also collects traces so that you can integrate your applications without additional code.  

DAPR Building Blocks & How to Use them? 

1. Service Invocation  

This Dapr building block is accountable for authorizing method calls and retries on remote services, irrespective of the location they are running on in the supported hosting environment. 

2. State management  

With the state management Dapr building block, you can write stateless and stateful services in the same application.  

3. Publish and subscribe messaging between services  

This Dapr building block is responsible for publishing events and subscribing to topics, thus enabling simplified horizontal scaling and resilience to failure in the future. 

4. Event-driven resource bindings  

Even driven resource buildings are responsible for exchanging events between external resources like databases, queues, file systems, blob stores, and webhooks. This facilitates scaling and resiliency in the event-driven architecture.  

5. Virtual actors  

Virtual actors simplify concurrency by using the method and state encapsulation. With its virtual actor runtime, Dapr provides capabilities like lifecycle management for actor activation/deactivation, state, timers, concurrency, and reminders to wake up actors. 

6. Distributed tracing between services 

This Dapr building block uses push events and W3C trace context standards for tracing and monitoring systems. This way you can easily detect and observe inter-service calls in production. 

What Challenges does Dapr Solve? 

1. Incremental Migration from Existing Code to Microservices  

Incrementally migrating from existing code to microservices architecture is difficult. However, Dapr makes the entire process easier by enabling developers to use any language or framework. This way they can solve the distributing system problems by easily writing microservices. 

2.  Tightly Controlled Feature Sets & Narrow Language Support  

Many programming model runtimes have tightly controlled feature sets and narrow language support. However, Dapr provides portability and consistency through open APIs and extensible community-driven components. 

3. Complicated Event-driven Architectures & State Handling 

Event-driven architectures and state handling can be difficult to scale because they are complicated. Dapr resolves this challenge by handling state, resource bindings, and pub/sub messaging, which enable event-driven, scalable, and resilient architectures. 

4. Limited Code Portability 

Most runtimes have limited code portability across the cloud and the edge. But since Dapr is platform-agnostic, it can run on any infrastructure including the public cloud and the edge devices by using open APIs. This way, the issue of limited code portability is resolved. 

Team Softobiz and Dapr 

Seeing the unlimited future possibilities, Softobiz has started capabilities in Dapr. With this, we have become the first Asian organization to incorporate microservices runtime into its organization. 

With this collaboration, we aim to empower our developers with the right knowledge of Dapr so that we can focus on the project requirements rather than having to worry about other non-functional aspects. 

As a part of this initiative, we recently conducted a two-day-long workshop in which the core Dapr team from Microsoft shared actionable insights about the microservices runtime. Even in the future, we have plans to go long way with Dapr and use it to unlock new possibilities in app development.  

Learn how we enable continuous delivery & deployment to deliver maximum business value by extending microservices to Front-end development.


Remote Working is the future, but are you ready?

WebRTC Architecture: Everything You Need to Know

How Secure is Your Data in the Cloud?

Harnessing the Power of GraphQL