akka-js / akka.js

Akka, for Scala.js
http://akka-js.org
474 stars 39 forks source link

[Question] Is akka.js production ready? #125

Closed tometchy closed 4 years ago

tometchy commented 4 years ago

Hi, akka.js looks really nice in demo, yet what interests me most is if it's still kind of experiment or it's production ready? I would like to use akka.js (with js api) in node.js application (written in typescript).

I don't need remoting, clustering, sharding, persistence etc. I just want to model my application with actor model, so only basic akka features required:

My goal is to use actor model with proper error kernel pattern, because I like this model for handling concurrency challenges.

Second part of this question (if all basic features are supported in js api) is how performance of this solution looks like. It's going to be node.js app (not in client side browser), so I wonder if it's tested in any kind of benchmarks?

andreaTP commented 4 years ago

Hey @tometchy ! First of all thanks a lot for your interest in the project! You know for sure that is always hard to answer a "production-ready" answer 😄 (I mean, modulo bugs everything is production-ready, isn't it?).

That said, this project is mostly about exposing Akka capabilities to the JS world and we do run quite a bunch of regression tests against the upstream Akka repo (e.g. this project is used for running the akka.io demos in the documentation).

From a Scala.js POV I'm pretty confident to say that you are covered, from a Js/Ts POV I need to update this repo: https://github.com/akka-js/akka.js_bindings (PRs are VERY welcome 😄 ) and I would say that stashing and supervision might be a rough edge there but, as well, not terrible to bind and note that the underlying functionality is already there full-fledged and tested.

Talking about performance I encourage you to take a look at those results: https://github.com/andreaTP/scalajs-benchmarks#last-results where average scenarios on Node are in a range 2/10 times slower than the JVM but running on a single thread! (that is a pretty amazing result actually), you can run those benchmarks against your target infrastructure and let me know the result, or, even better, you can craft a benchmark that shapes on your requirements and run it! (note that the skynet bench is mostly about objects creations and not about Actors-related stuff).

Keep chatting(even on gitter if you prefer a more direct interaction) and let me know if this answers your questions!

tometchy commented 4 years ago

Thanks, you answered my questions 100% :) Benchmarks are nice surprise, shown results satisfy me. Modeling code without stashing is acceptable, I can always write some own poor stash, but living without supervision is worse, as it's important part of error kernel pattern.

I came from C#/.Net(core) world and got use to akka.net so I know that akka over jvm is working well (and is much more mature than akka.net), but I've never written any code in scala nor I'm not much experienced with js stacks (so far only simple websites, I spend 95% of my time writing backend).

I'm here because I do investigation for new project which probably will be written in typescript on node.js, despite I'm C# guy (for few reasons this stack suits my needs better than C#, yet my decision is still not mature) but as I said I like the way akka solves concurrency problems that's why I ended up here.

I will close this issue as you covered my questions (even better than I expected) but of course we can continue talking here :)

andreaTP commented 4 years ago

Thanks for the feedback! Just to note that "supervision" is there, but I haven't invested time in exposing an idiomatic API for it.

tometchy commented 4 years ago
Great to hear that :) I've read whole readme of _akka.jsbindings project and must admit, that you've done great job! It looks it has more than enough to use it. A pity supervision strategies are not yet exposed (and the stash :D), but there is already much to use, for example adopted actors: Method Description
actor.path() Return a String representing a logical path associated to your actor, it can be used to identify an actor using the select method
actor.tell(msg) Send to the Actor the specified msg
actor.tell(msg, anotheractor) Send to the Actor the specified msg pretending the sender to be anotheractor
actor.kill() Will kill the specified actor
Method Description
this.path() Return the path of the Actor
this.parent() Return the array of the children of this Actor
this.children() Return the array of the children of this Actor
this.sender() Called within the receive method return the reference to the Actor that sent the message - inferring the sender has some limitations consider using explicit sender in the tell method to have it working reliably
this.self() Return the reference to itself
this.system() Return the ActorSystem this Actor belong to
this.spawn(actor) Let spawn an Actor as a child of this one, return it's reference
this.become(func) Change the current receive function to the argument func

It's really much. If you would need to port JVM akka to javascript (traditional way, like Akka.Net ports Akka) then I suppose this project would not be here where it is now (telling by numbers of commits in repo), so you've organized great solution with Scala.js

I'll watch for releases, maybe after adopting to javascript better I will feel comfortable enough to help you with some PR :)