Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for actors expressed as async/await fuctions? #13

Open
mcginty opened this issue Feb 19, 2021 · 3 comments
Open

Support for actors expressed as async/await fuctions? #13

mcginty opened this issue Feb 19, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@mcginty
Copy link
Collaborator

mcginty commented Feb 19, 2021

Do we want?? Do we not want??

@strohel strohel added the enhancement New feature or request label Feb 20, 2021
@strohel
Copy link
Member

strohel commented Feb 21, 2021

I presume this would mean: support actors whose handle() is an async fn, i.e. support for actors that run an async runtime in their thread.

It seems that Actix also somehow supports both sync and async actors through different implementations of its ActorContext trait. But Actix is clearly async-first.

Maybe a good time to consider this would be when we dog-food it. Otherwise I'd fear that async support could suffer from being a second-class citizen.

@mcginty
Copy link
Collaborator Author

mcginty commented Feb 22, 2021

Maybe another question worth asking is: how hard would it be to add async support after the initial release? Would it require major API changes?

@strohel strohel changed the title async/await? Support for actors expressed as async/await fuctions? Mar 3, 2021
@mbernat
Copy link
Contributor

mbernat commented Mar 28, 2024

Correct me if I'm wrong but you can always run an async runtime inside a blocking function (such as inside actor's handle). There also exist tiny single-threaded executors that could make this quite viable.

This is obviously wasteful when you want to have many such actors, so I suppose the point of this issue is instead to run a single runtime that the async actors can run on top of?

Another consideration is that async frameworks typically use tasks as units of execution and take care of running them on their own thread pools (at least in case of multithreaded executors such as the work-stealing one in tokio), so it differs from the current one-thread-per-actor model. OTOH, many systems support both these options (dedicated threads where necessary, thread pool for simpler tasks), so it sounds like a net benefit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants