Radoslav Gatev
Introducing Distributed Application Runtime (Dapr)
Simplifying Microservices Applications Development Through Proven and Reusable Patterns and Practices
1st ed.
Foreword by Yaron Schneider, Principal Software Engineer and Dapr co-founder, Microsoft
Logo of the publisher
Radoslav Gatev
Gorna Oryahovitsa, Bulgaria
ISBN 978-1-4842-6997-8 e-ISBN 978-1-4842-6998-5
https://doi.org/10.1007/978-1-4842-6998-5
Radoslav Gatev 2021
This work is subject to copyright. All rights are solely and exclusively licensed by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed.
The use of general descriptive names, registered names, trademarks, service marks, etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant protective laws and regulations and therefore free for general use.
The publisher, the authors and the editors are safe to assume that the advice and information in this book are believed to be true and accurate at the date of publication. Neither the publisher nor the authors or the editors give a warranty, expressed or implied, with respect to the material contained herein or for any errors or omissions that may have been made. The publisher remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
This Apress imprint is published by the registered company APress Media, LLC part of Springer Nature.
The registered company address is: 1 New York Plaza, New York, NY 10004, U.S.A.
To my girlfriend Desislava who supports me unconditionally.
Foreword
In the year leading up to the first release of Dapr as an open source project in October 2019, Haishi Bai (my partner in co-founding Dapr) and I observed just how much the cloud-native space had matured. It had grown to provide ops and infrastructure teams with first-class tools to run their workloads either on premises or in the cloud.
With the rise of Kubernetes (K8s), an entire ecosystem of platforms has sprung up to provide the missing pieces for network security, traffic routing, monitoring, volume management, and more.
Yet, something was missing.
The mission statement to make infrastructure boring was being realized, but for developers, many if not all of the age-old challenges around distributed computing continued to exist in cloud-native platforms, especially in microservice workloads where complexity grows with each service added.
This is where Dapr comes in. First and foremost a developer-facing tool, Dapr focuses on solving distributed systems challenges for cloud-native developers. But just like any new technology, its critical to be able to understand its uses, features, and capabilities.
This book by Radoslav Gatev is the authoritative, technical, hands-on resource you need to learn Dapr from the ground up. Up to date with version 1.0 of Dapr, this book gives you all you need to know about the Dapr building blocks and APIs (Application Programming Interfaces), when and how to use them, and includes samples in multiple languages to get you started quickly. In addition to the Dapr APIs, youll also find important information about how to debug Dapr-enabled applications, which is critical to running Dapr in production.
Radoslav has extensive, in-depth knowledge of Dapr and is an active Dapr contributor, participating in the Dapr community and helping others learn to use it as well. He makes the project better by working with maintainers to report issues and contribute content.
You really cant go wrong with this book, and I highly recommend it to anyone who wants to start developing applications with Dapr.
Yaron Schneider
Principal Software Engineer and Dapr Co-founder, Microsoft
Introduction
Being able to work on various projects, one should be able to identify the common set of issues every project faces. It doesnt mean you can always apply the same solution over and over again, but it puts a good structure. I was very lucky that early in my career, I was pointed to the proper things to learn. I have already been using object-oriented programming (OOP) for some time, but I was stunned when I read the book Design Patterns: Elements of Reusable Object-Oriented Software by Gamma, Helm, Johnson, and Vlissides for the first time. It gave me the answers to some of the questions Id been asking myself. From there on, I am a strong believer that patterns do not only serve as reusable solutions to common problems, they become a common lingo and teach you how to think in an abstract way. Being able to work at a conceptual level, instead of focusing too much on the details, I believe made me a better professional.
I heard of Distributed Application Runtime (Dapr) for the first time when it was announced at Microsoft Ignite 2019, Microsofts annual conference for developers and IT professionals. At first, the idea of it resonated within me but I didnt completely understand it, and so I decided to start playing with it. In September 2020, a transition to an open governance model was announced to ensure that the project is open and vendor neutral. Fast-forward to February 2021 when Dapr v1.0 was released. Now that Dapr is stable and production-ready, it is also in the process of being donated to the Cloud Native Computing Foundation (CNCF) as an Incubation project. By the time you read this, it may be finalized.
Dapr greatly simplifies the development of Microservices applications. It works with any language and any platform. You can containerize your applications or not, you can use Kubernetes or not, you can deploy to the cloud or not. You can sense the freedom here. From a development perspective, Dapr offers a number of capabilities grouped and packaged as building blocks. Lets face it. You will have to use some services that are external to the application you are aiming to build. It is very normal to not try to reinvent the wheel and build everything from scratch. By using the building blocks provided by Dapr, you use those external services without thinking about any SDKs or specific concepts imposed by the external service you are trying to integrate with. You just have to know how to work with the building block. This simplifies the operations you want to execute on the target external services, and Dapr serves as the common denominator. Thats why you can swap one technology with another in the scope of the building block, that is, reconfiguring Dapr from persisting state to, say, Redis to MySQL, for example.
Some believe Dapr is the service mesh but done right. The reason for that is that service meshes rely on the sidecar architecture as Dapr does. However, service meshes are for network infrastructure, while Dapr provides reusable patterns that are easy to apply and repeatable. In the future, I expect building blocks to expand in functionality and maybe new building blocks to come to Dapr. With that, the reach to potential external services will become so wide. For greenfield projects, this will mean that Dapr can be put on the foundational level of decisions. Once you have it, you can, later on, decide what specific message broker or what specific persistence medium to use for state storage, for example. This level of freedom unlocks many opportunities.