Showing posts from October, 2017

Silo configuration and Cluster management in Microsoft Orleans

Silo configuration and Cluster management in Microsoft Orleans Few weeks ago we saw how to create a Silo and how to implement grains. We also saw how we could create an ASP NET Core web app to talk to the Silo. We discovered the benefits of the single threaded model in grains. Today we will see one of the other major feature of Orleans, cluster management. This post will be composed by 3 parts: 1. Build a silo 2. Form a cluster with multiple silos 3. Cluster management with membership All the source code can be found on my GitHub. 1. Build a silo Let’s start first by implementing a Silo. We will be using the example we used in the past post. public class Program { public static void Main(string[] args) { var silo = new SiloHost("main"); silo.InitializeOrleansSilo(); var success = silo.StartOrleansSilo(); if (!success) { throw new Exception("Failed to start silo

Microsoft Orleans Grains Concurrency Handling

Microsoft Orleans Grains Concurrency Handling Few weeks ago I explained the benefits of using Microsoft Orleans . One of them was the implementation of the actor pattern. Today I will dig deeper into it by revisiting a common scenario present in today systems and how it can be solved with Orleans grains. This post will be composed by 3 parts: 1 - Traditional system 2 - The problems 3 - Grain solution 1. Traditional system In a traditional system, we can often see a N-tier architecture (usually 3-tier) composed by the following: Front end -> Service tier -> Database The front end being the webserver like ASP NET. The service tier being a set of stateless services containing business logic. They ensure the consistency of the system by extracting the latest state of business object from the database, validate business rules and write back to database ~ the last tier. In this sort of architecture, the database is the source of truth. This can be illustrated with the following

Create a simple Microsoft Orleans application

Create a simple Microsoft Orleans application Last week I presented an overview of Microsoft Orleans . Gave an explanation on the concepts and keywords which can be found in the framework. Today I will explain how we can implement a simple Orleans application with a cluster composed by a localhost Silo and with a client within an ASP Net Core Mvc application. This post will be composed by 3 parts: 1. Implement the grains 2. Create the silo 3. ASP Net Core Mvc client 1. Implement the grains The grains are the unit of work in an Orleans application. They contain the business logic and ensure that the state is consistent. In our example we will be implementing a Bank account grain with a withdraw and deposit functionality. There will be a single business rule being that the balance of any account cannot be lower than 0. We start first by creating the grain interface in a project where we reference Orleans.Core . public interface IBankAccount: IGrainWithStringKey { Task Deposi

A first look at Microsoft Orleans

A first look at Microsoft Orleans Microsoft Orleans is a framework used to build scalable distributed systems. It reduces the complexity of distributed system by abstracting away concurrency issues together with state management. Processes can then be run on multiple instances and form a cluster, they can be hosted on different environment and be scaled up and down on demand. Today I will give a broad overview of the concepts utilized and developed by the team behind Orleans. This post will be compose by 3 parts: 1. Motivations 2. Definitions 3. How does it work? 1. Motivations The two main benefits of Orleans is that it: reduces the complexity of coding applications by providing a simpler model to maintain object oriented codebase. Orleans moves away from the N-tier type of architecture where business logic is held in stateless services and state is persisted in database by providing its own implementation of the actor pattern where the actor is a stateful unit of work where co