Rfcs: Create a Rust actor library with high-level patterns, recovery, networking, sandboxing

Created on 21 Jan 2015  路  28Comments  路  Source: rust-lang/rfcs

Issue by brson
_Monday Sep 24, 2012 at 20:46 GMT_

_For earlier discussion, see https://github.com/rust-lang/rust/issues/3573_

_This issue was labelled with: A-an-interesting-project, A-concurrency, A-libs, I-wishlist, P-low in the Rust repository_


Rust has a lot of powerful concurrency tools, but they aren't packaged up into a high-level, consistent interface.

Things that would be great in an actor library:

  • High-level help with implementing actor patterns, nice interface, minimal boilerplate
  • Cross-process actors with sandboxing. Sandboxing is very important to Servo, which has some initial sandboxing libraries.
  • Network-based messaging and actors
  • Reliable failure and recovery schemes. Rust has linked task failure, but no higher-level constructs to help users make use of it for creating reliable systems ala Erlang OTP.

Take inspiration from Scala, Akka and Erlang.

This probably isn't suitable for the main repo, but would be very useful for projects like Servo.

A-community-library T-libs

Most helpful comment

All 28 comments

IMO this belongs in a dedicated crate and not the stdlib.

Tagging as 'community library' for exactly that reason.

I started work here: https://github.com/carllerche/astaire However, I am focusing on syncbox futures & streams at the moment. I think Futures & Streams will be a good abstraction to use with actors as well...

+1. Is this one in the right direction - https://github.com/withoutboats/Chekhov ?

@brson @steveklabnik @ayosec yay, i'm currently working on an actor library (the one linked above) and I was wondering what kind of features would be expected.

It currently mostly works on a single machine and has recovery (except for huge failures).

The only issue is that I currently have neither users nor use cases so I don't know what are the most desired features and thus I'm kinda working in the dark.

Would you have a list of stuff that would be nice to have (pretty please) ? Because once I'm done with the networking (in a week or two I guess) I will be out of ideas :/

@gamazeps I would suggest talking a look at Akka as a mature actor framework. There is a core lib which has actors, routers, dispatchers with supervision of crashed actors to manage local work. Then there are the remote extensions to do location transparency. Then there is clustering and server life cycle to be containers to do remote deployment of actors. That's all way, way too much and very much "everyone and the kitchen sink" but it has a good core library that can give good inspiration. My personal favourite is Akka FSM (finite state machine) where you define which matching functions apply to which state then have an API to switch states (hence matching functions) for the next message. So at this link is an actor which does Multi-Paxos for distributed consensus written as a FSM actor https://github.com/trex-paxos/trex/blob/codacy-changes/core/src/main/scala/com/github/simbo1905/trex/internals/PaxosActor.scala

@simbo1905 yup, i'm quite aware of the akka library (I have read the documentation half a dozen time while implementing RobotS), this is the example / inspiration I have used this far, my question was more about which specific features in akka (or erlang, or any other actor framework) are the most desirable :)

As said before the "module", I'm gonna work next is the one for networking and location transparency.
I am wondering which next "modules" I should work on / improve, because as you said there are far too many and since I don't have a use case yet, I need to know where to prioritize my efforts :)

Thanks for the more than complete answer :)

@gamazeps That would be a great question to ask on the subreddit, or maybe the user forums. You'll find a lot more people there to discuss it.

@gsingh93 fair enough :)

I would go straight to http://doc.akka.io/docs/akka/snapshot/scala/typed.html :)

That was my bedside book for a few weeks :)

@gamazeps I was about to point you to this docs section of akka-typed in your blog post about Box (your Disqus comments section isn't loading though), but I guess you have already seen it then ;)

Yeah I have to fix this comment section at some point...

Now that future-rs is out I guess that there is a way to get some of it in RobotS (their code is much better than mine).

Is this still active?
I would like to propose this:
https://github.com/AsynkronIT/gam/issues/35

GAM is built on my experience building Akka.NET (port of Akka) I have reused the concepts that work well, and removed the parts that doesnt.
It could easily be ported to Rust.

Hi, I think the actor library can be added to the stdlib, because:

  • It's a programming model, so it can be another choice to solve problem. It'd be more famous if it was in the stdlib.
  • Correct me, if I'm wrong. It can be used to create servers and that's a part of 2017 roadmap RFC.
    > - Rust should be well-equipped for writing robust, high-scale servers

Why not:

  • It isn't very famous, so it may not be worth it.

It's my first comment in Rust. I hope you give me feedback to be better.

For what it's worth I just published RobotS on crates.io.

It's still very rough, but works decently in a local environment (network is still missing).

I am currently working on a better typing of the actors (I'll try to publish the proposed solution on my website and here by the end of the weekend or next week), sorry if the library was not very active, real life was a bit overwhelming recently, and since no one used robots, I assumed it was not a priority.

maybe this can be a suitable jump start for actors: https://citybound.github.io/citybound/kay/index.html

Actix looks good.

Since actix et. al exists I'm closing this.

Could we please reopen this to have some more discussion?

@naturallymitchell creating libraries is not something usually done via the RFC process, so this probably wouldn't be the best place to discuss it, unless you want to "bless" an existing actor library in some official way.

where is the appropriate place to discuss this (I'm guessing not here)?

@mk270 You can bring up a thread on https://internals.rust-lang.org/ if you want to get this into std. However, I don't think that will go over well because an actor framework is a huge investment for a std, and Rust likes to keep it's std small.

If you don't want to put this in std, then https://users.rust-lang.org/ can help out. You probably want to learn actix though. (and urlo can help you learn it)

@mk270 I would suggest creating something first be it a crate or a blog post explaining your ideas, get feedback on that via reddit, urlo, etc. see if more people are interested via those channels and then iterate.

If you only want to discuss it right now then "create something" could mean a post on https://users.rust-lang.org/ discussing some existing attempts.

Hey guys, we can also discuss Actix on Discord: https://discord.gg/2A9h75V

Centril, Actix was a good choice.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

camden-smallwood-zz picture camden-smallwood-zz  路  3Comments

3442853561 picture 3442853561  路  3Comments

Diggsey picture Diggsey  路  3Comments

onelson picture onelson  路  3Comments

p-avital picture p-avital  路  3Comments