Millions of Actors

I have an app in Objective-C which has a tree of nodes, which have children, which are either nodes or leafs.
The children do something and notify their parent when done.
This is done via NSOperation.
To avoid data races the nodes use an NSLock.

I am thinking of converting these nodes to Actors.

The question:
As there might be millions of nodes:
is having this number of actors a totally preposterous idea?
Or would this just work fine?
I could just try this myself. But as this is a non trivial task, I would like to ask here first.

Gerriet.

Actors are fairly lightweight, they really just are a “slightly larger class”; unless they’re running they’re not using up any resources other than memory as well.

So theoretically speaking, you are only limited by available memory in terms of “actors in a system”. The number of actors actively running in parallel is limited by the shared global thread pool, which is related to how many cores you have. So… depending on your use case, the answer may be yes or no, kind of the same like asking if you can have milllions of class instances :slight_smile:

3 Likes
Terms of Service

Privacy Policy

Cookie Policy