Texera / texera

Collaborative Machine-Learning-Centric Data Analytics Using Workflows
https://texera.github.io
Apache License 2.0
162 stars 73 forks source link

ProtoActor actor framework evaluation #626

Closed StephenLiu7 closed 6 years ago

StephenLiu7 commented 6 years ago

Installing Proto.Actor

Install Microsoft Visual Studio 2017 using Visual Studio Installer Select .NET desktop development Check .NET Core 2.0 development tools in order to install Proto.Actor capture In Visual Studio 2017 Search and Install Proto.Actor via NuGet Packages

If the version of Proto.Actor from Nuget Packages is too outdated compared to the GitHub version. We can follow the instruction on the link (https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package-using-visual-studio) and make/publish our own package to use. The dependency of self-made packages will be updated automatically.

StephenLiu7 commented 6 years ago

Draft report of Proto.Actor

What is Proto.Actor Proto.Actor unifies both of these two ways (classical Erlang/Akka style actors and Microsoft Orleans style "virtual actors") of working under a common framework. Proto.Actor solves another major issue which means that Proto.Actor can communicate between platforms. Proto.Actor allows user can pick and choose languages for our different actor based microservices (For example, a cluster can be hybrid different actors can be written in different languages)(http://proto.actor/docs/what%20is%20protoactor#location-transparency link to the documentation for more details). For example, we can choose to include only the parts of Proto.Actor we need in our application or we can use the whole package with persistence and clustering.

Proto.Actor implements a form called "parental supervison". Actors can only be created by other actors. The top-level actor is provided by the library and each created actor is supervised by its parent. Benefit: guarantees that actors cannot be orphaned or attached to supervisors from the outside, which might otherwise catch them unawares. In addition, this yields a natural and clean shutdown procedure for (sub-trees of) actor applications. (Supervision related parent-child communication happens by special system messages that have their own mailboxes separate from user messages.)

screen shot 2018-07-05 at 2 26 11 pm

Relation to Microsoft Orleans Proto.Actor is based on the same conceptual distributed hash table and automatic placement strategies as Microsoft Orleans. The cluster Grains are also similar in the sense that they use an RPC based interface. Benefits of Virtual Actor: join and leave of a cluster will only have limited influence to the cluster (Detailed examples please see Proto.Actor documentation: Proto.Cluster). Drawbacks: When the node that owns the name of an actor unexpectedly leaves the cluster. This leaves the actor activation orphaned somewhere in the cluster. When someone now tries to call this actor, a new node will be associated with the name, and the actor will be activated again somewhere in the cluster. This will lead multiple activations.

Orleans also provides Muti-cluster support and transparent scalability as Proto.Actor. Proto.Actor has a more clear Supervision system than Orleans(Orleans only has runtime monitoring and partial automatic error handling.) The complexity of retry action in Orleans depends on the exact application. Supervision of Proto.Actor (reacts to failure) describes a dependency relationship between actors: the supervisor delegates tasks to subordinates and therefore must respond to their failures. When a subordinate detects a failure (i.e. throws an exception), it suspends itself and all its subordinates and sends a message to its supervisor, signaling failure. Depending on the nature of the work to be supervised and the nature of the failure, the supervisor has a choice of the following four options: "Resume" the subordinate, keeping its accumulated internal state "Restart" the subordinate, clearing out its accumulated internal state "Stop" the subordinate permanently "Escalate" the failure to the next parent in the hierarchy, thereby falling itself The default behavior of the Restarting event of actors is to terminate all its children before restarting, but this hook can be overridden. See Proto.Actor documentation for One-For-One Strategy/All-For-One strategy for details. actorlifecycle According to Proto.Actor Lifecycle diagram, it seems that we can't suspend an actor and restart it manually without an error which is not suitable with our suspend/resume operator.

Relation to Akka The core parts of Proto.Actor loosely follow the conceptual API of Akka like the parent-child supervision system. Compared to virtual actors in Orleans and Proto.Actors, the developer of Akka has to care about actor lifecycles, placement and failures.

Suggestion Proto.Actor is under developing since many documentations/examples are blank or incomplete which may cause obstacles to us when implementing it as our backend engine (https://gitter.im/AsynkronIT/protoactor). Besides, the poor support of suspend/resume operator is not compatible with our system. We can put more focus on evaluating other engines.