Microsoft Orleans Introduction
Managing asynchronous environments and distributed systems is difficult and complex, and the complexity is a matter of those systems, we are now in 2022 where we begin to focus more into abstractions and keep the performance as is, so we need delivery be fast and stable in our systems.
In early beginning of systems, from creation of Functional Programming to the OOP, we need the things to be simple, as the paradigm of just programming focus of Synchronous operations, we simplify the context to something in our life, taking the paradigm of Objects exist in real world to our computers, It make it easy to map the world into our computers
Microsoft take a step in last years to serve the tackling of complexity, supporting the distributed systems, such drive the .Net to be lightweight enough to be managed such “kestrel server” , Microservices architecture and So on, One of these steps that is really attractive is “Orleans” framework.
Orleans as Microsoft described: “is a cross-platform framework for building robust, scalable distributed applications. It builds on the developer productivity of .NET and brings it to the world of distributed applications, such as cloud services.”
Scale from a Single-On your premises computer to be globally distributed system.
Such ability is to focus on write a simple code without take the concern of how this code be scalable over machines.
Orleans is not only who can achieve this purpose, Orleans is a way but there are many and old frameworks and libraries achieve the purpose, has the same strategy of tackling domain such as Akka.net and DAPR.
Orleans extends familiar concepts like objects, interfaces, async
and await
, and try/catch to multi-server environments.
Orleans come from a Microsoft Research publication Orleans — Virtual Actors — Microsoft Research as an implementation of Virtual Actors Model to be part of .Net.
It comes with new concept of Grains.
“The fundamental building block in any Orleans application is a grain. Grains are entities comprising user-defined identity, behavior, and state.”
The Grain has “identity” : is a user defined “Id” which can be accessed, Imagine it can be your User Id, and you can access his Grain with his Id, and with that Id it can be available for invocation.
Like any object can have Behavior and State, the behavior is its functionality or how can change his state (Data) or other Grains States.
Imagine you can Tackle your Users into grains so
UserGrain = {
Identity = User/Guid Id or any claim ,
Behavior = class(User),
State = “In memory or in persistent storage” }
Grains can have volatile or persistent state data that can be stored in any storage system. As such, grains implicitly partition application states, enabling automatic scalability and simplifying recovery from failures.
Grain state is kept in memory while the grain is active, leading to lower latency and less load on data stores.
Instantiation of grains is automatic process performed by demand, Imagine your user when begin his session, he instantiated his Grain and the state loaded into memory, when the user close session the State is be persisted.
Grain can initiate another grain,
Imagine your user need to access his resource files and update on them, so the resource is another grain established to manage the resource.
Taken together, the stable identity, statefulness, and managing the lifecycle of grains are core factors that make systems built on Orleans scalable, performant, and reliable without forcing developers to write complex distributed systems code.
Now we are done in introduction the next publish will be on implementations.
Bye, Keep coding……..