Busy .NET Developer's Guide to Orleans

ted.neward@newardassociates.com | Blog: http://blogs.newardassociates.com | Github: tedneward | LinkedIn: tedneward

Objectives

Our goal here is to:

Microsoft Orleans: Overview

In a nutshell

Microsoft Orleans: Overview

What is it?

Orleans Concepts

What's important to know?

Orleans Concepts

Core concepts:

Orleans Concepts

Grain

Orleans Concepts

Grain identity

Orleans Concepts

Grain state

Orleans Concepts

Grain interface

Orleans Concepts

Message

Orleans Concepts

Silo

Orleans Concepts

Cluster

Orleans Concepts

Host

Orleans Concepts

Rules of thumb

Remote Procedure Calls

An abstraction over network communication

Remote Procedure Calls

Overview

RPC Concepts

What's at work here

RPC Concepts

Distributed systems

RPC Concepts

RPCs in a nutshell

RPC Concepts

Under the hood

RPC Concepts

Under the hood

RPC Concepts

Under the hood

RPC Concepts

Major parts

RPC Concepts

Insights

RPC Concepts

Drawbacks

Actors Model

How do we process concurrently without driving ourselves mad?

Actors Model

History

Actors Model

Nutshell concepts

Actors Model

Actors Model

Actors Model

Actors Implementation

Actors Model

Messages

Actors Model

Outcomes/Consequences

Orleans Getting Started

Zero to Go in....

Orleans Getting Started

Platform requirements

Orleans Getting Started

Hello, Orleans

Orleans Getting Started

Interfaces

Orleans Getting Started

IHelloWorld

public interface IHelloWorld : Orleans.IGrainWithIntegerKey
{
    Task<string> SayHello(string name);
}

Orleans Getting Started

Grains (implementations)

Orleans Getting Started

HelloWorld

public class HelloWorld : Orleans.Grain, IHelloWorld
{
    private readonly ILogger _logger;

    public HelloWorld(ILogger<HelloWorld> logger) { _logger = logger; }

    public Task<string> SayHello(string name)
    {
        _logger.LogInformation("SayHello: name = '{name}', ", name);

        return Task.FromResult($"Hello, {name}, welcome to Orleans");
    }
}

Orleans Getting Started

Host

Orleans Getting Started

Program.cs

    var builder = new HostBuilder()
        .UseOrleans(c =>
        {
            c.UseLocalhostClustering()
            .Configure<ClusterOptions>(options =>
            {
                options.ClusterId = "dev";
                options.ServiceId = "HelloWorld";
            })
            .ConfigureApplicationParts(
                parts => parts.AddApplicationPart(typeof(HelloWorld).Assembly).WithReferences())
            .ConfigureLogging(logging => logging.AddConsole());
        });

    var host = builder.Build();
    await host.StartAsync();

Orleans Getting Started

Client

Orleans Getting Started

Client Setup

    var client = new ClientBuilder()
        .UseLocalhostClustering()
        .Configure<ClusterOptions>(options =>
        {
            options.ClusterId = "dev";
            options.ServiceId = "HelloWorld";
        })
        .ConfigureLogging(logging => logging.AddConsole())
        .Build();

    await client.Connect();
    Console.WriteLine("Client successfully connected to silo host \n");

Orleans Getting Started

Client calling host

    var friend = client.GetGrain<IHelloWorld>(0);
    var response = await friend.SayHello("Good morning, HelloGrain!");

Orleans Basics

Implementing Orleans actors

Orleans Basics

Grains

Orleans Basics

Grain References

Orleans Basics

Interfaces

Orleans Basics

Interfaces

More

Other topics

Summary

What is Orleans?

Resources

Where to go to get more

Resources

Code/Github

Resources

Books

Credentials

Who is this guy?