I have Akka application which is essentially traverses a very large tree
where each vertex processing is done by an individual actor. Different
kinds of vertices are processed by different actors. The actors are
implemented as prototype Spring beans (they are derived from the same
abstract class) and I am using Akka/Spring integration from Akka Spring
integration <https://github.com/typesafehub/activator-akka-java-spring>.
The only two differences between the githib example and my code is that I
use configuration file to configure the routers and the way I get actor
references.
Since the example only uses one actor it creates it like
system.actorOf(SpringExtProvider.get(system).props("CountingActor"),
"counter");
My actor system is hierarchical and I create my actors differently
public ActorRef createActorRef(String actorBeanName, String
actorRouterName) {
ActorRef actor = null;
final scala.Option<ActorRef> child = context().child(actorRouterName);
if (child != null && child.isDefined()) {
actor = child.get();
} else {
actor =
getContext().actorOf(SpringExtProvider.get(system).props(actorBeanName).withRouter(new
FromConfig()), actorRouterName);
}
}
When my system is running for few days it runs out of memory. I ran the
profiler and discovered that there is a huge number of actor's Spring beans
being instantiated. So I instrumented my actors with the instance counters:
public abstract class MyActor extends UntypedActor {
private static AtomicInteger instantiationCount = new AtomicInteger(0);
public MyActor() {
logger.info("ACTOR CREATED. Instantiation count {}",
instantiationCount.getAndIncrement());
}
@Override
protected void finalize() {
logger.info("ACTOR FINALIZED. Instantiation count {}",
instantiationCount.getAndDecrement());
}
}
When I run my application I see constant flow of "ACTOR CREATED" log
entries with ever incrementing counter with the finalize() method never
called. Eventually after few days of running the system runs out of memory.
I am wondering if I am doing something wrong with obtaining the actor
references or there is some issues with Akka/Spring integration
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.