Richard Astbury
Microsoft Orleans for Developers
Build Cloud-Native, High-Scale, Distributed Systems in .NET Using Orleans
The Apress logo.
Richard Astbury
Woodbridge, UK
ISBN 978-1-4842-8166-6 e-ISBN 978-1-4842-8167-3
https://doi.org/10.1007/978-1-4842-8167-3
Richard Astbury 2022
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.
This book is dedicated to all those who have contributed to the Orleans community.
Introduction
Welcome!
This book aims to help the experienced dotnet developer understand what Orleans is, what problems it solves, and how to get started with an Orleans project. No prior knowledge of distributed systems is required, but it is useful to have a good grasp of C#, ASP.NET Core, and unit testing.
The first two chapters provide a brief history and backstory, helping you understand where Orleans began and the core concepts, namely, Grains and Silos.
The main body of the book starts with a Hello World example and then explores several of the features of Orleans by building more functionality into this application. This helps us to understand the functionality of Orleans by taking practical steps and building something thats a, sort of, real system.
I have included a couple of chapters on more advanced features, including optimizations. I dont attempt to add all of these to the sample application, and instead explain how theyre used and the problems they solve.
Software is built by people, and it was important to me to include some interviews in this book from people who are/were in the core team as well as the community. I hope you enjoy reading their perspectives.
Orleans is a great fit for some really interesting challenges, particularly around high-scale, real-time systems, but it doesnt fit every problem. Part of being an experienced developer is knowing the best tool to use for a given problem. My hope is that this book will help you develop your intuition, so when you have finished reading (however far you get!), youll know an Orleans-shaped problem when you see one.
Any source code or other supplementary material referenced by the author in this book is available to readers on GitHub.
Table of Contents
About the Author
Richard Astbury
works at Microsoft UK, helping software teams build software systems to run in the cloud. Richard is a former Microsoft MVP for Windows Azure. He is often found developing open source software in C# and Node.js, navigating the river on his paddle board, and riding his bike. He lives in rural Suffolk, UK, with his wife, three children, and golden retriever.
About the Technical Reviewer
Sergey Bykov
is one of the creators of Orleans and a long-time lead of the project since its inception within Microsoft Research. During his nearly 20 years at Microsoft, he has worked on servers, embedded systems, online and gaming services. His passion has always been about providing tools and frameworks for software engineers, to help them build better, faster, more reliable and scalable systems and applications with less effort. He continues to follow that passion, now at Temporal Technologies.
You can read Sergeys blog at https://dev.to/sergeybykov and follow him on Twitter @sergeybykov.
The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2022
R. Astbury Microsoft Orleans for Developers https://doi.org/10.1007/978-1-4842-8167-3_1
1. Fundamentals
Microsoft Orleans is a free, open source framework built on Microsoft .NET, which provides the developer with a simple programming model enabling them to build software which can scale from a single machine to hundreds of servers.
You can think of Orleans as a distributed runtime, which runs software across a cluster of servers, treating them as a single address space. This allows the developer to build software which keeps lots of data in memory, by spreading objects across the clusters shared memory space. This enables low-latency systems, where requests can be processed using data held in memory without deferring to a database. This allows the system to deal with a high volume of traffic.
Orleans is designed to support cloud-native applications, with elasticity and fault tolerance.
Orleans is a batteries included framework, which ships with many of the features required for distributed systems built in.
Motivation for Orleans
When I first started serious programming in the early 1990s, it was just me, my PC, and Turbo Pascal 7. The terrible software I wrote just ran on a single machine, an IBM PS/2 8086, which had a single CPU core and no network.
Fast-forward to the present day and the progress made in computer hardware is astonishing. Computers now have multiple cores, with 440 being the current state of the art. Cloud computing provides us with near instant rental to computers with per-minute billing, almost limitless horizontal scalability, and accessible to anyone via a ubiquitous global network the Internet.
While programming languages have also evolved, most mainstream languages are still generally focused on running a sequence of instructions on a single computer. Some languages runtimes dont even have support for multithreading and distributing work across multiple cores.
In order to satisfy the requirements of real-time web applications and IoT gateways, developers are required to build systems that can deal with high volumes of traffic, handle hardware failure, and do this with elasticity to optimize for cost. We need to make efficient use of the hardware, which means running code efficiently on multicore computers, horizontally scaled in the cloud.