/orleans

Orleans - Distributed Virtual Actor Model

Primary LanguageC#MIT LicenseMIT

Orleans logo

Build status NuGet Gitter Help Wanted Issues

Orleans is a framework that provides a straight-forward approach to building distributed high-scale computing applications, without the need to learn and apply complex concurrency or other scaling patterns.

It was created by Microsoft Research implementing the Virtual Actor Model and designed for use in the cloud.

Orleans has been used extensively running in Microsoft Azure by several Microsoft product groups, most notably by 343 Industries as a platform for all of Halo 4 and Halo 5 cloud services, as well as by a number of other projects and companies.

Installation

Installation is performed via NuGet. There are several packages, one for each different project type (interfaces, grains, silo, and client).

In the grain interfaces project:

PM> Install-Package Microsoft.Orleans.OrleansCodeGenerator.Build

In the grain implementations project:

PM> Install-Package Microsoft.Orleans.OrleansCodeGenerator.Build

In the server (silo) project:

PM> Install-Package Microsoft.Orleans.Server

In the client project:

PM> Install-Package Microsoft.Orleans.Client

Official Builds

The stable production-quality release is located here.

The latest clean development branch build from CI is located: here

Nightly builds are published to https://dotnet.myget.org/gallery/orleans-ci . These builds pass all functional tests, but are not thoroughly tested as the stable builds or pre-release builds we push to NuGet.org

Building from source

Clone the sources from the GitHub repo

Run the Build.cmd script to build the nuget packages locally, then reference the required NuGet packages from /Artifacts/Release/*. You can run Test.cmd to run all BVT tests, and TestAll.cmd to also run Functional tests (which take much longer)

Building and running tests in Visual Studio 2017

.NET Core 2.0 SDK is a pre-requisite to build Orleans.sln.

There might be errors trying to build from Visual Studio because of conflicts with the test discovery engine (error says could not copy xunit.abstractions.dll). The reason for that error is that you need to configure the test runner in VS like so (after opening the solution):

  • Test -> Test Settings -> Uncheck Keep Test Execution Engine running
  • Test -> Test Settings -> Default Processor Architecture -> Check X64

Then either restart VS, or go to the task manager and kill the processes that starts with vstest.. Then build once again and it should succeed and tests should appear in the Test Explorer window.

Documentation

Documentation is located here

Code Examples

Create an interface for your grain:

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

Provide an implementation of that interface:

public class HelloGrain : Orleans.Grain, IHello
{
  Task<string> SayHello(string greeting)
  {
    return Task.FromResult($"You said: '{greeting}', I say: Hello!");
  }
}

Call the grain from your Web service (or anywhere else):

// Get a reference to the IHello grain with id '0'.
var friend = GrainClient.GrainFactory.GetGrain<IHello>(0);

// Send a greeting to the grain and await the response.
Console.WriteLine(await friend.SayHello("Good morning, my friend!"));

Blog

Orleans Blog is a place to share our thoughts, plans, learnings, tips and tricks, and ideas, crazy and otherwise, which don’t easily fit the documentation format. We would also like to see here posts from the community members, sharing their experiences, ideas, and wisdom. So, welcome to Orleans Blog, both as a reader and as a blogger!

Community

License

This project is licensed under the MIT license.

Quick Links

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.