Giter VIP home page Giter VIP logo

dotnet / orleans Goto Github PK

View Code? Open in Web Editor NEW
10.0K 504.0 2.0K 65.45 MB

Cloud Native application framework for .NET

Home Page: https://docs.microsoft.com/dotnet/orleans

License: MIT License

PowerShell 0.05% C# 98.71% Smalltalk 0.01% F# 0.10% Batchfile 0.02% PLpgSQL 0.40% PLSQL 0.18% TSQL 0.37% Dockerfile 0.01% Shell 0.02% CSS 0.03% HTML 0.09%
actor-model distributed-actors distributed-systems cloud-computing concurrency orleans cloud-native actors dotnet

orleans's Introduction

Orleans logo

NuGet Follow on Twitter

Discord

Orleans is a cross-platform framework for building robust, scalable distributed applications

Orleans builds on the developer productivity of .NET and brings it to the world of distributed applications, such as cloud services. Orleans scales from a single on-premises server to globally distributed, highly-available applications in the cloud.

Orleans takes familiar concepts like objects, interfaces, async/await, and try/catch and extends them to multi-server environments. As such, it helps developers experienced with single-server applications transition to building resilient, scalable cloud services and other distributed applications. For this reason, Orleans has often been referred to as "Distributed .NET".

It was created by Microsoft Research and introduced the Virtual Actor Model as a novel approach to building a new generation of distributed systems for the Cloud era. The core contribution of Orleans is its programming model which tames the complexity inherent to highly-parallel distributed systems without restricting capabilities or imposing onerous constraints on the developer.

Grains

A grain is composed of a stable identity, behavior, and state

The fundamental building block in any Orleans application is a grain. Grains are entities comprising user-defined identity, behavior, and state. Grain identities are user-defined keys which make Grains always available for invocation. Grains can be invoked by other grains or by external clients such as Web frontends, via strongly-typed communication interfaces (contracts). Each grain is an instance of a class which implements one or more of these interfaces.

Grains can have volatile and/or persistent state that can be stored in any storage system. As such, grains implicitly partition application state, 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.

A diagram showing the managed lifecycle of a grain

Instantiation of grains is automatically performed on demand by the Orleans runtime. Grains which are not used for a while are automatically removed from memory to free up resources. This is possible because of their stable identity, which allows invoking grains whether they are already loaded into memory or not. This also allows for transparent recovery from failure because the caller does not need to know on which server a grain is instantiated on at any point in time. Grains have a managed lifecycle, with the Orleans runtime responsible for activating/deactivating, and placing/locating grains as needed. This allows the developer to write code as if all grains were always in-memory.

Taken together, the stable identity, statefulness, and managed lifecycle of Grains are core factors that make systems built on Orleans scalable, performant, & reliable without forcing developers to write complex distributed systems code.

Example: IoT cloud backend

Consider a cloud backend for an Internet of Things system. This application needs to process incoming device data, filter, aggregate, and process this information, and enable sending commands to devices. In Orleans, it is natural to model each device with a grain which becomes a digital twin of the physical device it corresponds to. These grains keep the latest device data in memory, so that they can be quickly queried and processed without the need to communicate with the physical device directly. By observing streams of time-series data from the device, the grain can detect changes in conditions, such as measurements exceeding a threshold, and trigger an action.

A simple thermostat could be modeled as follows:

public interface IThermostat : IGrainWithStringKey
{
    Task<List<Command>> OnUpdate(ThermostatStatus update);
}

Events arriving from the thermostat from a Web frontend can be sent to its grain by invoking the OnUpdate method which optionally returns a command back to the device.

var thermostat = client.GetGrain<IThermostat>(id);
return await thermostat.OnUpdate(update);

The same thermostat grain can implement a separate interface for control systems to interact with:

public interface IThermostatControl : IGrainWithStringKey
{
    Task<ThermostatStatus> GetStatus();

    Task UpdateConfiguration(ThermostatConfiguration config);
}

These two interfaces (IThermostat and IThermostatControl) are implemented by a single implementation class:

public class ThermostatGrain : Grain, IThermostat, IThermostatControl
{
    private ThermostatStatus _status;
    private List<Command> _commands;

    public Task<List<Command>> OnUpdate(ThermostatStatus status)
    {
        _status = status;
        var result = _commands;
        _commands = new List<Command>();
        return Task.FromResult(result);
    }
    
    public Task<ThermostatStatus> GetStatus() => Task.FromResult(_status);
    
    public Task UpdateConfiguration(ThermostatConfiguration config)
    {
        _commands.Add(new ConfigUpdateCommand(config));
        return Task.CompletedTask;
    }
}

The Grain class above does not persist its state. A more thorough example demonstrating state persistence is available in the docs, for more information see Microsoft Orleans: Grain Persistence.

Orleans runtime

The Orleans runtime is what implements the programming model for applications. The main component of the runtime is the silo, which is responsible for hosting grains. Typically, a group of silos run as a cluster for scalability and fault-tolerance. When run as a cluster, silos coordinate with each other to distribute work, detect and recover from failures. The runtime enables grains hosted in the cluster to communicate with each other as if they are within a single process.

In addition to the core programming model, the silo provides grains with a set of runtime services, such as timers, reminders (persistent timers), persistence, transactions, streams, and more. See the features section below for more detail.

Web frontends and other external clients call grains in the cluster using the client library which automatically manages network communication. Clients can also be co-hosted in the same process with silos for simplicity.

Orleans is compatible with .NET Standard 2.0 and above, running on Windows, Linux, and macOS, in full .NET Framework or .NET Core.

Features

Orleans is a feature-rich framework. It provides a set of services that enable the development of distributed systems. The following sections describe the features of Orleans.

Persistence

Orleans provides a simple persistence model which ensures that state is available to a grain before requests are processed and that consistency is maintained. Grains can have multiple named persistent data objects, for example, one called "profile" for a user's profile and one called "inventory" for their inventory. This state can be stored in any storage system. For example, profile data may be stored in one database and inventory in another. While a grain is running, this state is kept in memory so that read requests can be served without accessing storage. When the grain updates its state, a state.WriteStateAsync() call ensures that the backing store is updated for durability and consistency. For more information see Microsoft Orleans: Grain Persistence.

Distributed ACID transactions

In addition to the simple persistence model described above, grains can have transactional state. Multiple grains can participate in ACID transactions together regardless of where their state is ultimately stored. Transactions in Orleans are distributed and decentralized (there is no central transaction manager or transaction coordinator) and have serializable isolation. For more information, see the Microsoft Orleans: Transactions.

Streams

Streams help developers to process series of data items in near-real time. Streams in Orleans are managed: streams do not need to be created or registered before a grain or client publishes to a stream or subscribes to a stream. This allows for greater decoupling of stream producers and consumers from each other and from the infrastructure. Stream processing is reliable: grains can store checkpoints (cursors) and reset to a stored checkpoint during activation or at any point afterwards.

Streams supports batch delivery of messages to consumers to improve efficiency and recovery performance. Streams are backed by queueing services such as Azure Event Hubs, Amazon Kinesis, and others. An arbitrary number of streams can be multiplexed onto a smaller number of queues and the responsibility for processing these queues is balanced evenly across the cluster.

Timers & reminders

Reminders are a durable scheduling mechanism for grains. They can be used to ensure that some action is completed at a future point even if the grain is not currently activated at that time. Timers are the non-durable counterpart to reminders and can be used for high-frequency events which do not require reliability. For more information, see Microsoft Orleans: Timers and reminders.

Flexible grain placement

When a grain is activated in Orleans, the runtime decides which server (silo) to activate that grain on. This is called grain placement. The placement process in Orleans is fully configurable: developers can choose from a set of out-of-the-box placement policies such as random, prefer-local, and load-based, or custom logic can be configured. This allows for full flexibility in deciding where grains are created. For example, grains can be placed on a server close to resources which they need to operate on or other grains which they communicate with.

Grain versioning & heterogeneous clusters

Application code evolves over time and upgrading live, production systems in a manner which safely accounts for these changes can be challenging, particularly in stateful systems. Grain interfaces in Orleans can be optionally versioned. The cluster maintains a mapping of which grain implementations are available on which silos in the cluster and the versions of those implementations. This version information is used by the runtime in conjunction with placement strategies to make placement decisions when routing calls to grains. In addition to safe update of versioned grains, this also enables heterogeneous clusters, where different silos have different sets of grain implementations available. For more information, see Microsoft Orleans: Grain interface versioning.

Elastic scalability & fault tolerance

Orleans is designed to scale elastically. When a silo joins a cluster it is able to accept new activations and when a silo leaves the cluster (either because of scale down or a machine failure) the grains which were activated on that silo will be re-activated on remaining silos as needed. An Orleans cluster can be scaled down to a single silo. The same properties which enable elastic scalability also enable fault tolerance: the cluster automatically detects and quickly recovers from failures.

Run anywhere

Orleans runs anywhere that .NET Core or .NET Framework are supported. This includes hosting on Linux, Windows, and macOS and deploying to Kubernetes, virtual or physical machines, on premises or in the cloud, and PaaS services such as Azure Cloud Services.

Stateless workers

Stateless workers are specially marked grains which do not have any associated state and can be activated on multiple silos simultaneously. This enables increased parallelism for stateless functions. For more information, see Microsoft Orleans: Stateless worker grains documentation.

Grain call filters

Logic which is common to many grains can be expressed as an interceptor, or Grain call filter. Orleans supports filters for both incoming and outgoing calls. Some common use-cases of filters are: authorization, logging and telemetry, and error handling.

Request context

Metadata and other information can be passed along a series of requests using request context. Request context can be used for holding distributed tracing information or any other user-defined values.

Documentation

The official documentation for Microsoft Orleans is available at https://docs.microsoft.com/dotnet/orleans.

A variety of samples are available in the official .NET Samples Browser.

Get started

Please see the getting started tutorial.

Building

On Windows, 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.

On Linux and macOS, run dotnet build to build Orleans.

Official builds

The latest stable, production-quality release is located here.

Nightly builds are published to a NuGet feed. These builds pass all functional tests, but are not thoroughly tested as the stable builds or pre-release builds published to NuGet.

Using the nightly build packages in your project

To use nightly builds in your project, add the MyGet feed using either of the following methods:

  1. Changing the .csproj file to include this section:
<ItemGroup>
  <RestoreSources>
    $(RestoreSources);
    https://pkgs.dev.azure.com/dnceng/public/_packaging/orleans-nightly/nuget/v3/index.json
  </RestoreSources>
</ItemGroup>

or

  1. Creating a NuGet.config file in the solution directory with the following contents:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <clear /> 
    <add key="orleans-nightly" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/orleans-nightly/nuget/v3/index.json" />
    <add key="nuget" value="https://api.nuget.org/v3/index.json" />
  </packageSources>
</configuration>

Community

Discord

License

This project is licensed under the MIT license.

Quick links

orleans's People

Contributors

attilah avatar benjaminpetit avatar carlm-ms avatar cata avatar dixonds avatar dvakulen avatar elanhasson avatar gabikliot avatar galvesribeiro avatar ievangelist avatar jason-bragg avatar jdom avatar jkonecki avatar jorgecandeias avatar jsteinich avatar jthelin avatar kucheruk avatar ledjon-behluli avatar mmitche avatar ningnad avatar pentp avatar pherbel avatar reubenbond avatar richorama avatar sebastianburckhardt avatar sergeybykov avatar shayhatsor avatar veikkoeeva avatar xiazen avatar yevhen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

orleans's Issues

Code generation does not correctly escape language keywords used as identifiers

Parameters which use language keywords as their name are not correctly escaped by current code generation, which causes compilation failures.

For example, this will cause generated code to fail to compile:

public interface IReproGrain : IGrainWithIntegerKey
{
  Task Repro(int @event, bool @new, string @class);
}

A bunch of early adopters have run into this issue (serves us right for calling parameters "event" 😝)

Add deployment based queue balancer

Add a queue balancer (IStreamQueueBalancer) which uses the deployment configuration to determine how many silos to expect and uses a silo status oracle to determine which of the silos are available. It should use this information to balance the queues with the following requirements.
• Even distribution of resources across silos
• Minimize movement of resources when rebalancing from changes in active silos.
• Must be deterministic independent of previous queue distribution state.

This is work that didn't make it in prior to moving depot to github.

Function Cast is not accessible (in codegen)

I am getting the error below when I compile one of my iGrain interfaces.

Error   6   'Orleans.GrainFactory.Friend Shared Function Cast(Of TGrainInterface)(grain As Orleans.Runtime.IAddressable) As TGrainInterface' is not accessible in this context because it is 'Friend'.  C:\Users\Benjamin\Documents\Visual Studio 2013\Projects\KeynotelyOrleans\Keynotely.GrainInterfaces\GeneratedFiles\orleans.codegen.vb    1689    190 Keynotely.GrainInterfaces

What appears to be the trigger of this error is if I pass an iGrain in to a parameter of a function in the iGrain interface.

For example:

Function SaveIndexAsync(grainType As String, propertyName As String, propertyValue As Object, grainReference As IGrain) As task

The GrainFactory isn't exposing the Cast function, where as GrainFactoryWith*****Key all expose the cast, for example if I updated my code to:

Function SaveIndexAsync(grainType As String, propertyName As String, propertyValue As Object, grainReference As IGrainWithStringKey) As task

It will compile fine, I am not sure if this a bug, or is by design - any input or thoughts are welcome.

1.0 + Road Map

We're evaluating Orleans for suitability in an upcoming project, it certainly ticks a lot of boxes for us.

One sticking point at the moment though is around current project status and where it might go from here.

  1. How close are we to a 1.0 release?
  • What is left to do before 1.0?
  • Given the above, were we to adopt 0.9 now, how much friction do you anticipate in moving to 1.0
  1. What is the Road Map for the framework?
  • Once 1.0 is out, where does the project go from here?
  • Are there plans to continue pushing it forward or is it your intention to hand it over to the community?

Thank in advance.

Consider renaming NuGet packages

Current name of the NuGet packages is ProjectOrleans.xxx.

Consider renaming it to Orleans.xxx or Microsoft.Orleans.xxx.
The word project in the package name doesn't seem to add any value and won't help with powershell auto-completion (orl + TAB).

I'm happy to update all the nuspec files

Contribution idea: Add support for Bond/Avro/other serialization

One way to support Bond is to allow to use it optionally in addition to the built-in Orleans-generated serializers, similar to custom serializers. That way code that already uses Bond could work with Orleans.
The solution will probably need to add a message header to indicate serializer used
Will be less automatic than the built-in option but compatible with non-.NET clients
Explore other ways to use Bond.

Support for custom (default) placement strategies

Currently the default placement strategy is rather hardwired and limited and it is only possible to tweak it using the built-in placement strategies. I'd like to propose that we open up PlacementDirectorsManager, PlacementStrategy, and PlacementDirector so grain solutions can opt to create their own placement strategies for more specialised setups. Simultaneously, it would be beneficial to be able to specify a custom default placement strategy in the configuration and have that take effect globally rather than having to go through all the grains and add attributes to them.

Some of the custom placement strategies that might be of interest could be to limit new activations to not overwhelm a fixed machine setup (e.g. in a non-cloud/non-virtual setup), place activations according to expected communication coherence, etc.

Consider renaming dlls \ exes \ namespaces

Not as simple as changing NuGet package names but I think this should be discussed before wider adoption. Those are breaking changes and it's better to bite the bullet now.

I would like to suggest we change Orleans dlls \ exes to Microsoft.Orleans.xxx. and change the namespaces accordingly.

What are your thoughts?

Unordered attribute

This one is not documented anywhere but is visible on API's public surface.. It' also the only one which targets grain interface (all other attributes target grain implemenation classes).

What does it do?

Ideas for contributions

We added a page with some initial ideas for contributions. Let's use this issue for discussing the list and adding to it. Please create separate issues to discuss individual ideas/features.

Allow for custom IMembershipTable implementations

Currently there are 3 IMembershipTable implementations, a "development only" grain-based implementation, an Azure Table Storage implementation, and a SQL Server implementation.

I want to be able to reliably bootstrap silos without relying on SQL Server or Azure Table Storage.

It would be great if we could have a model for injecting custom IMembershipTable implementations.

Samples & VSIX

The source code builds properly, however, when I run "InstallOrleansVSTools.cmd", it fails to find what it needs or there is a permission problem is what it reports(see pic).

Since that failed, I installed the VSIX manually, but the Hello World sample fails to build.

I originally tried this in VS2012, but got the same results in VS2013 on a different machine.
untitled

Managing state when refactoring grains?

As projects move forward requirements change and code ends up being refactored, this could as simple as a namespace being changed, or Oect1Grain being renamed to Object2Gain etc..

What is the recommend way of handling state when this happens? as my understanding from looking at how the state is stored, the grain type is linked to the state record (for example in Azure Storage it becomes the RowKey). Which would imply that refactoring/renaming the grain or namespace would break the reading of the previous state when the service is updated.

One possible solution could to be to add an attribute to the grain (like we do with the storage provider) which allows us to specify the Type as string to override the default type that would be provided enabling backwards compatibility with old state?

I'd would be interested to hear how others are approaching the scenario, or point out something I may have missed.

Reminder service fails to start with SQL server system store

When using the SqlServer system store, the reminders service fails to read from the database during silo startup. It looks like the hash value changed from int to uint between the preview and 1.0 release, however, SQL Server doesn't natively handle unsigned datatypes.

[2015-01-24 17:51:45.973 GMT     8            ERROR  102920  ReminderService             127.0.0.1:11111]               !!!!!!!!!! Failed to read rows from table. 
Exc level 0: System.ArgumentException: No mapping exists from DbType UInt32 to a known SqlDbType.
   at System.Data.SqlClient.MetaType.GetMetaTypeFromDbType(DbType target)
   at System.Data.SqlClient.SqlParameter.set_DbType(DbType value)
   at Orleans.Runtime.ReminderService.SqlReminderTable.<ReadRows>d__a.MoveNext() in H:\Orleans\src\OrleansRuntime\ReminderService\SqlReminderTable.cs:line 73
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Orleans.Runtime.ReminderService.LocalReminderService.<ReadTableAndStartTimers>d__2d.MoveNext() in h:\Orleans\src\OrleansRuntime\ReminderService\LocalReminderService.cs:line 268

A uniform interface is

I'd like to discuss an addition of a uniform communication interface, which has potential for seriously improving Orleans' interoperability, extensibility and ease-of-use for a number of advanced scenarios.

AzureWebSample: worker role exception.

Hi.

Running AzureWebSample I always get AzureSilos worker role recycling, with following trace.

Any suggestion?

Microsoft.WindowsAzure.ServiceRuntime Information: 100 : Role environment . INITIALIZING
Microsoft.WindowsAzure.ServiceRuntime Verbose: 500 : Role instance status check starting
Microsoft.WindowsAzure.ServiceRuntime Verbose: 502 : Role instance status check succeeded: Ready
Microsoft.WindowsAzure.ServiceRuntime Information: 100 : Role environment . INITIALED RETURNED. HResult=0
Microsoft.WindowsAzure.ServiceRuntime Information: 101 : Role environment . INITIALIZED
'WaWorkerHost.exe' (CLR v4.0.30319: RdRuntime): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\WindowsAzureTelemetryEvents\v4.0_2.5.0.0__31bf3856ad364e35\WindowsAzureTelemetryEvents.dll'. Cannot find or open the PDB file.
'WaWorkerHost.exe' (CLR v4.0.30319: RdRuntime): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\WindowsAzureEventSource\v4.0_2.5.0.0__31bf3856ad364e35\WindowsAzureEventSource.dll'. Cannot find or open the PDB file.
'WaWorkerHost.exe' (CLR v4.0.30319: RdRuntime): Loaded 'C:\Progetti\orleans\Samples\AzureWebSample\OrleansAzureSample\csx\Debug\roles\OrleansAzureSilos\approot\Orleans.Azure.Silos.WorkerRole.dll'. Symbols loaded.
'WaWorkerHost.exe' (CLR v4.0.30319: RdRuntime): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Microsoft.WindowsAzure.ServiceRuntime\v4.0_2.4.0.0__31bf3856ad364e35\Microsoft.WindowsAzure.ServiceRuntime.dll'. Cannot find or open the PDB file.
Microsoft.WindowsAzure.ServiceRuntime Information: 200 : Role entrypoint . CALLING OnStart(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
Microsoft.WindowsAzure.ServiceRuntime Information: 202 : Role entrypoint . COMPLETED OnStart(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
The thread 0x33a8 has exited with code 259 (0x103).
A first chance exception of type 'System.Threading.WaitHandleCannotBeOpenedException' occurred in mscorlib.dll
Microsoft.WindowsAzure.ServiceRuntime Information: 203 : Role entrypoint . CALLING Run(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
Microsoft.WindowsAzure.ServiceRuntime Warning: 204 : Role entrypoint . COMPLETED Run() ==> ROLE RECYCLING INITIATED: Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
Microsoft.WindowsAzure.ServiceRuntime Information: 503 : Role instance recycling is starting
The thread 0x3954 has exited with code 259 (0x103).
Microsoft.WindowsAzure.ServiceRuntime Information: 205 : Role entrypoint . CALLING OnStop(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
Microsoft.WindowsAzure.ServiceRuntime Information: 205 : Role entrypoint . CALLING OnStopping()
Microsoft.WindowsAzure.ServiceRuntime Information: 206 : Role entrypoint . COMPLETED OnStop(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint

The thread 0x2db8 has exited with code 259 (0x103).
'WaWorkerHost.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Cannot find or open the PDB file.
'WaWorkerHost.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Progetti\orleans\Samples\AzureWebSample\OrleansAzureSample\csx\Debug\roles\OrleansAzureSilos\base\x64\WaWorkerHost.exe'. Cannot find or open the PDB file.
'WaWorkerHost.exe' (CLR v4.0.30319: WaWorkerHost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_64\msshrtmi\v4.0_2.5.0.0__31bf3856ad364e35\msshrtmi.dll'. Cannot find or open the PDB file.
'WaWorkerHost.exe' (CLR v4.0.30319: WaWorkerHost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Microsoft.WindowsAzure.ServiceRuntime\v4.0_2.5.0.0__31bf3856ad364e35\Microsoft.WindowsAzure.ServiceRuntime.dll'. Cannot find or open the PDB file.
'WaWorkerHost.exe' (CLR v4.0.30319: Domain 2): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Cannot find or open the PDB file.
'WaWorkerHost.exe' (CLR v4.0.30319: RdRuntime): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Microsoft.WindowsAzure.ServiceRuntime\v4.0_2.5.0.0__31bf3856ad364e35\Microsoft.WindowsAzure.ServiceRuntime.dll'. Cannot find or open the PDB file.
'WaWorkerHost.exe' (CLR v4.0.30319: WaWorkerHost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\mscorlib.resources\v4.0_4.0.0.0_it_b77a5c561934e089\mscorlib.resources.dll'. Module was built without symbols.
'WaWorkerHost.exe' (CLR v4.0.30319: WaWorkerHost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Cannot find or open the PDB file.
'WaWorkerHost.exe' (CLR v4.0.30319: RdRuntime): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Cannot find or open the PDB file.
'WaWorkerHost.exe' (CLR v4.0.30319: RdRuntime): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.ServiceHosting.Tools.DevelopmentFabric.Runtime\1.0.0.0__31bf3856ad364e35\Microsoft.ServiceHosting.Tools.DevelopmentFabric.Runtime.dll'. Cannot find or open the PDB file.
'WaWorkerHost.exe' (CLR v4.0.30319: RdRuntime): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'. Cannot find or open the PDB file.
'WaWorkerHost.exe' (CLR v4.0.30319: RdRuntime): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll'. Cannot find or open the PDB file.
'WaWorkerHost.exe' (CLR v4.0.30319: RdRuntime): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'. Cannot find or open the PDB file.
'WaWorkerHost.exe' (CLR v4.0.30319: RdRuntime): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Cannot find or open the PDB file.
'WaWorkerHost.exe' (CLR v4.0.30319: RdRuntime): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_64\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll'. Cannot find or open the PDB file.
'WaWorkerHost.exe' (CLR v4.0.30319: RdRuntime): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_64\msshrtmi\v4.0_2.5.0.0__31bf3856ad364e35\msshrtmi.dll'. Cannot find or open the PDB file.
Microsoft.WindowsAzure.ServiceRuntime Information: 100 : Role environment . INITIALIZING
Microsoft.WindowsAzure.ServiceRuntime Information: 100 : Role environment . INITIALED RETURNED. HResult=0
Microsoft.WindowsAzure.ServiceRuntime Information: 101 : Role environment . INITIALIZED
'WaWorkerHost.exe' (CLR v4.0.30319: RdRuntime): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\WindowsAzureTelemetryEvents\v4.0_2.5.0.0__31bf3856ad364e35\WindowsAzureTelemetryEvents.dll'. Cannot find or open the PDB file.
'WaWorkerHost.exe' (CLR v4.0.30319: RdRuntime): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\WindowsAzureEventSource\v4.0_2.5.0.0__31bf3856ad364e35\WindowsAzureEventSource.dll'. Cannot find or open the PDB file.
'WaWorkerHost.exe' (CLR v4.0.30319: RdRuntime): Loaded 'C:\Progetti\orleans\Samples\AzureWebSample\OrleansAzureSample\csx\Debug\roles\OrleansAzureSilos\approot\Orleans.Azure.Silos.WorkerRole.dll'. Symbols loaded.
'WaWorkerHost.exe' (CLR v4.0.30319: RdRuntime): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Microsoft.WindowsAzure.ServiceRuntime\v4.0_2.4.0.0__31bf3856ad364e35\Microsoft.WindowsAzure.ServiceRuntime.dll'. Cannot find or open the PDB file.
Microsoft.WindowsAzure.ServiceRuntime Information: 200 : Role entrypoint . CALLING OnStart(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
Microsoft.WindowsAzure.ServiceRuntime Information: 202 : Role entrypoint . COMPLETED OnStart(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
The thread 0x3290 has exited with code 259 (0x103).
A first chance exception of type 'System.Threading.WaitHandleCannotBeOpenedException' occurred in mscorlib.dll
Microsoft.WindowsAzure.ServiceRuntime Information: 203 : Role entrypoint . CALLING Run(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
Microsoft.WindowsAzure.ServiceRuntime Warning: 204 : Role entrypoint . COMPLETED Run() ==> ROLE RECYCLING INITIATED: Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
Microsoft.WindowsAzure.ServiceRuntime Information: 503 : Role instance recycling is starting
The thread 0x2a7c has exited with code 259 (0x103).
Microsoft.WindowsAzure.ServiceRuntime Information: 205 : Role entrypoint . CALLING OnStop(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint
Microsoft.WindowsAzure.ServiceRuntime Information: 205 : Role entrypoint . CALLING OnStopping()
Microsoft.WindowsAzure.ServiceRuntime Information: 206 : Role entrypoint . COMPLETED OnStop(): Microsoft.WindowsAzure.ServiceRuntime.DefaultEntryPoint

Indexing Grain State?

I have a few scenarios where the grain state needs to be indexed, so it is possible to either lookup a grain by something else other than the primary key.

One of those examples would be trying to implement an Orleans Provider for ASP Identity. For example GetUserByName and GetUserByEmail I also have a few domain specific scenarios as well.

The way I am currently approaching this, (which most likely not the best way but it is working at the moment on a simple level) is I am saving the UserEntity to ATS along with saving the Index Properties to ATS as well.

I then have a stateless grain which does the lookup of ATS to find the index I want, which then allows me to get the UserGrain by the Id.

It seems rather cumbersome way of getting the grain (but it works), however I was reading an old research paper "Orleans: Cloud Computing for Everyone" which talks about a Queryable attribute.

Annotations on grain interface members, such as Queryable, are used by the developer to cause Orleans to generate additional methods on the factory class for searching for grains that satisfy specified conditions.

Does a feature like this exist in the current build?

I have been pondering other ways to lookup and index which could cut down the network traffic from hitting ATS, so another thought I had was to have a grain to manage the lookup for each index. So call the lookupGrain which then had a reference to the actual grain I wanted.

It would be great to get any input on what thoughts there are around best practice in regard to looking up a grain by different properties within the state.

Project template/wizard for Azure deployment

Worker role for silos (in our experience it is better to star a silo as a standalone process and wait on the process handle in the worker roles code)
Worker/web role for frontend clients
Configuration of diagnostics, ETW tracing, etc.
Try Azure SDK plug-in as suggested here by @richorama.

Mixing attributes

There are a number of attribute combinations which doesn't make sense to mix together. For example: mixing StatelessWorker with any of Placement attributes doesn't make sense, but it looks like currently it is allowed to combine them within same class declaration.

I'm not sure what will happen in this case and I guess that handling code is smart enough to just ignore placement attributes if used along with StatelessWorker. Nevertheless, I found it to be confusing and I think it might be better to fail with exception to prevent users polluting grain declarations with useless combinations of attributes, which will confuse all future readers. Also, such validation should prevent users from cargo-culting Orleans.

Other invalid combinations:

  • Mixing attributes from same category - looks like now I can put both RandomPlacement and ActivationCountBased or PreferLocal. Which one will Orleans choose?
  • Reentrant could be mixed with AlwaysInterleave - seems like another confusing combination. Grain is either fully reentrant (class-level attribute) - all methods are subject to interleaving, or only some individual methods allow interleaving.

Another, possible and probably more intuitive approach will be, is to group all choices under respective category attributes (and use AllowMultiple=false), to make alternation explcit. Something like:

  • Activation - Singleton / StatelessWorker
  • Concurrency - Strict / Reentrant
  • Placement - Random / PreferLocal / ActivationCountBased
  • Delivery - Ordered / Unordered
  • etc

What do you think?

Application Bootstrap within a Silo

please give a code way to boostrap silo

 var BOOTSTARTP_PROVIDER_CONFIGS_NAME = "Bootstrap";
            ProviderCategoryConfiguration providerConfiguration;
            if (!siloHost.Config.Globals.ProviderConfigurations.TryGetValue(BOOTSTARTP_PROVIDER_CONFIGS_NAME, out providerConfiguration))
            {
                providerConfiguration = new ProviderCategoryConfiguration()
                {
                    Name = BOOTSTARTP_PROVIDER_CONFIGS_NAME,
                    Providers = new Dictionary<string, IProviderConfiguration>()
                };
            }

            var eventStoreProvider = new ProviderConfiguration(new Dictionary<string, string>(), typeof(EventStoreInitBootstrapProvider).FullName, "EventStoreInitBootstrapProvider");
            providerConfiguration.Providers.Add("EventStoreInitBootstrapProvider", eventStoreProvider);

            siloHost.Config.Globals.ProviderConfigurations[BOOTSTARTP_PROVIDER_CONFIGS_NAME] = providerConfiguration;

but failed. I read the source code ,find some class have method like AddProvider ,but internal

please give a way to give the Application Bootstrap by code.

ClientConfiguration vs OrleansConfiguration assymetry

While I can perfectly load OrleansConfiguration using

new OrleansConfiguration().Load(new StringReader(embeddedResourceFile));

The ClientConfiguration does not provide this method in it's public interface, so currently I'm using this filthy hack:

var loader = result.GetType().GetMethod("Load", BindingFlags.Instance | BindingFlags.NonPublic, null, new[] {typeof(TextReader)}, null);
loader.Invoke(result, new object[]{LoadFromEmbeddedResource(assembly, fullResourcePath)});

Also, I think renaming OrleansConfiguration to 'ServerConfiguration` will add consistency and perfect symmetry (Client/Server). The principle of "no surprises" - is a hallmark of a good API =))

aka.ms/orleans

Could I suggest pointing the http://aka.ms/orleans link to this repo now?

(also - on an unrelated note) I see there is a 1.0.0 branch, is this a release branch? Where can I get the installer for that? (codeplex is still on 0.9)

...and the CI server is returning a 404 :¬(

Update dependencies to Azure SDK 2.5

In order to get AzureWebSample working (although it is likely that same should be done to deploy any Orleans applications on Azure environment), it seems that several Orleans components have to be updated to correct dependencies from Azure SDK 2.5.

Please refer to #67 for details.

Codegen mixing up VB and C#

I have a class in which is make up of a set of properties just to store data data, when I but that as a parameter or result in a grain interface the class library fails to build.

for example Function FindByEmailAsync(email As String) As Task(Of UserDataEntity)

I am currently using VB, when I look at the errors it is failing because the generated code (orleans.codegen.vb) it is a mix of VB and C#.

The generated class the errors appear in is the '*_UserDataEntitySerialization' and appears in the functions DeepCopier, Serializer and Deserializer.

For example the following is generated:
Dim temp21 As Object = CType(Orleans.Serialization.SerializationManager.DeepCopyInner(fieldInfo21.GetValue(input)),Action<Object,OperationContext,IDictionary<String,EntityProperty>>)

But I would assume it should be something like:
Dim temp21 As Object = CType(Orleans.Serialization.SerializationManager.DeepCopyInner(fieldInfo21.GetValue(input)), Action(Of Object, OperationContext, IDictionary(Of String, EntityProperty)))

Or I am doing something totally wrong, if so happy to be guided in the right direction.

Auto-generate documentation from code.

Auto-generated documents can help provide more complete and up-to-date documentation with little effort.

I'm thinking first steps might be.

  1. Select code generator - Doxygen?
  2. Create basic configurations and script to generate reference manual like documentation.

Then we can refine the comments in code to improve the generated documents.

When generated documentation is of sufficient quality we can:
3) Incorporate document generation into the builds.
4) Add automation to publish documents online whenever repository is updated.

Thoughts?

IGrainObserver not useable in with VB (CodeGen Issue)

I have come across another small bug in the CodeGen which prevents using IGrainObserver in being used with VB

Adding the following interface to the GrainInterfaces project creates a compile error.

Public Interface IMyObserver
        Inherits IGrainObserver

End Interface

The code generated that is invalid is

Public Shared Sub DeleteObjectReference(reference As onShowcase.Distributed.GrainInterfaces.ApplicationData.IMyObserver) As System.Threading.Tasks.Task
            Return Global.Orleans.Runtime.GrainReference.DeleteObjectReference(reference)
End Sub

It is declaring a sub/void but then trying to return a task.

It is caused by

Public Shared Sub DeleteObjectReference(reference As {0}) As System.Threading.Tasks.Task

Unification of ClientId

Orleans client currently uses a Guid to uniquely identify itself when connecting to a gateway silo.
In addition, there is also a notion of client grain id that is used to identify client. There is some redundancy between those two. This issue to fix that, by eliminating the Guid client id and using Client Grain id to uniquely identify that client.
This fix is a first part of the bigger work on improving client observers.

Replace static codegen'd factory classes with generic factories

Currently, we are exposing codegen'd factory classes for IGrainObservers (there may be others, please add them here).

We should create a generic factory which provides access to the codegen'd factories and hide the concrete implementation.

This will help us with Dependency Injection and give us the flexibility to use runtime codegen (eg, via Roslyn)

Adjustments to RowKey on OrleansSiloStatistics

Before I go and write the code for this, I thought it would be worth having the discussion.

Current design

Presently the scheme for the PartitionKey / RowKey fields on OrleansSiloStatistics is as follows:

PartitionKey: SiloName:Date
RowKey: DeploymentId:Epoch:counter

For example:

PartitionKey: 17b8149c37384e16aa5672193dc8daa1:2014-08-15
RowKey: S100.74.190.62:11111:145792311:000001

Problems

Table storage can only return values in the alphabetical order of the partition/row keys. It would be nice to have the keys laid out such that a simple query (just fetch 1000 entities from the table) always retrieves the latest records written to the system.

A technique for doing this is documented here: http://blog.smarx.com/posts/using-numbers-as-keys-in-windows-azure

It would also be nice to have a deterministic way of retrieve the data, without knowing the machine names, i.e. just supply a date range to retrieve all data in that period.

Suggested solution

My suggestion is this format:

PartitionKey: Date:SiloName
RowKey: EpochCountdown:DeploymentId:counter

Where EpochCountdown is a padded string, counting down the seconds to the end of the epoch.

Note that the order of the keys has also been changed.

PartitionKey: 2014-08-15:17b8149c37384e16aa5672193dc8daa1
RowKey: 854207689:S100.74.190.62:11111:000001

Impact

This technique gives you a date-first approach to reading the data, and makes it harder to query by a single machine.

I would have to make some adjustments to my SiloMon project!

Otherwise, I'm not sure how widely used this table is?

Other thoughts

Is colon : the best character to use as a separator? It's a character used by the silo name. Perhaps using a dollar $ would be better?

Execute continuation in a new independent non-reentrant request

Many times we do some work and then do an external service call (or even a grain call) that we would like to process once it returns, but in the meantime, we'd like end the current turn. Once the response comes back, it's be nice to execute the continuation as a full new turn.

Currently it's easy to do things like

someClient.ExecuteIoCallAsync().ContinueWith(this.MyCustomContinuation)

In order to end the turn but then execute the continuation... nevertheless the continuation, albeit running in a single thread in the grain, can interleave with other turns. So in order to workaround that, we sometimes have to do a grain call to tself in the callback, so that it executes as a new request and doesn't interleave. This workaround is not that trivial and still prone to errors, ignoring the fact that you have to "pollute" the public-facing grain interface with the internal details of how we deal with continuations.

Wouldn't it be nice to do something like this instead?

UPDATE: In this thread the code evolved a lot, and we are currently discussing something that doesn't use await. I'd encourage you to look at the updated gist instead: https://gist.github.com/jdom/6597e183eabd3251f4bd

public async Task MyPublicGrainMethod()
{
  // do some async work in the "1st turn"
  await this.SomethingThatNeedsToRunDuringTheGrainCall();

  // now start the async call that I don't want to await during the grain call, but I want the continuation to run in a full turn.
  var myIoTask = someClient.ExecuteIoCallAsync();
  var response = await myIoTask.ConfigureAwaitInNewTurn(endCurrentTurn: true);
  // use response here in a "2nd" turn. Notice that interleaving might have happened by this time, but given you are using ConfigureAwaitInNewTurn, you should know that this is an advanced scenario and be aware of the consequences, such as using closures or ackowledging that state might have mutated by now.
}

I made that example verbose, so that we can discuss ideas... I don't know if it's even possible to end the turn abruptly in the middle of the method, as the task returned by MyPublicGrainMethod might not be completed yet (or can the await logic complete that task instead?, that'd be ideal).

I'm all ears and open to feedback, as this is a simplification of a scenario we use a lot.

Proper way to build SDK 1.0?

Hi.

What is the right way to build SDK so that setting OrleansSDK evnironment variable everything works as with 0.9 SDK installer?

Will you provide precompiled SDK too (either on Codeplex site or on GitHub)?

Thanks!

Mailing list as a replacement for CodePlex forums

At the moment GitHub does not provide discussion forums functionality. Since the project is moving out of CodePlex, consider creating a mailing list (Google Groups or similar) to have a place where people can ask questions, give feedback and get support from the community.

P.S. StackOverflow could be another possible alternative.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.