Closed shafqatevo closed 3 years ago
Sorry for the delay, my gitHub inbox was too full and I missed this question.
Isolate's overhead depends a lot on what code you'll run in them. I agree they are heavy but it's hard to tell just how heavy in general.
Currently, when you create an Actor, it will start an isolate and keep it alive until you close the Actor. You can also use an ActorGroup
to get something similar to a "thread pool".
Finally, you could also use the Messenger
mixin, I believe, to implement actors that internally delegate to multiple async Messengers, but in this case they cannot be considered to be true "actors" as they would share memory. If you introduce shared memory, you cannot claim to adhere to the actor model anymore as that introduces race conditions which the actor model is supposed to prevent.
If you have more concrete ideas for improvement please let me know.
EDITED after reviewing source.
Hi @renatoathaydes , thanks for sharing this framework!
Since isolates are heavyweight (memory overhead 2MB), did you consider any approach to instead “schedule” multiple actors per isolate? Like actor schedulers / process schedulers in other actor frameworks.
Thanks!