Skip to content

When does it make sense to use an actor vs a simple event loop? #3889

Answered by Darksonn
ilmoi asked this question in Q&A
Discussion options

You must be logged in to vote

Here's another use-case for actors: If you have a server with many open connections that need to communicate with each other, then wrapping each connection in an actor is usually a good strategy. In my article that you linked, I mention this in the following paragraph:

For example, if you are implementing a chat server, you may spawn a task for each connection, and a master task that routes chat messages between the other tasks. This is useful because the master task can avoid having to deal with network IO, and the connection tasks can focus exclusively on dealing with network IO.

I usually link to this project as an example of this. It goes through various features of the article:

  • It…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ilmoi
Comment options

Answer selected by Darksonn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants