-
Notifications
You must be signed in to change notification settings - Fork 64
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
self.createActor() with globalName from inisde an ActorTypeDispatcher increases size of self #66
Comments
Hi @gerowam , thanks for the report and the corresponding analysis. I can confirm that I see just over 800 bytes of consumption for each The increased memory consumption is a necessity of the distributed nature of the Actor environment. In concordance with your concern about storing the global address locally, the Thespian implementation must check with the Admin each time a "new" address is requested, and there must be local storage associated with this new address; any attempt to locally cache that information would suffer the same out-of-date issue you noted. Probably a better way to address this situation is to have an Actor that provides management capabilities for other Actors (let's call this the "Maker" actor in the following discussion, and the term "Global" refers to the corresponding global actor, while the term "Client" refers to an actor wishing to communicate with the global actor). In this configuration, the Thespian
In the above scenario, Maker is a very simple implementation, but since Maker also acts as the parent actor for Global (or any number of Global actors), it will actively know when Global exits and another version needs to be created. The Client actors require a slightly longer protocol to get the address of Global from Maker, but they don't need any additional complexity. In this scenario, the growth of memory needed for actor address management should be limited to only those cases where the Global actor exits and needs to be re-created. |
Environment:
Linux ikeh2 5.13.0-27-generic #29~20.04.1-Ubuntu SMP Fri Jan 14 00:32:30 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Python 3.8.10
thespian==3.10.6
Calling
self.createActor(..., globalName='some_named_actor')
from within anActorTypeDispatcher
correctly returns the address ofsome_named_actor
if it exists. But every call increases the size ofself
. Specifically, it looks likes_myRef._addrManager._managed
seems to get a newthespian.actors.ActorAddress
every call, even whensome_named_actor
exists.Running the attached example:
Also attached is similar output with a recursive memory inspection of the
ActorTypeDispatcher
instance after each wakeup, which callscreateActor()
with the sameglobalName
. Note the memory size info requires thePympler
package.Is this behaviour expected? If so, is there a way to get the address of a named actor from within an
ActorTypeDispatcher
instance without callingcreateActor()
? Or is there a more suitable pattern for sharing access to a globally-referencable actor to other, less-persistent actors? My concern with simply storing the address of the global actor is that if it crashes (and is revived by some supervisory process), then the stored address will be invalidated with no way to know.leaktest.tar.gz
The text was updated successfully, but these errors were encountered: