[rules-users] Drools compiler memory & stateless sessions?
Mark Proctor
mproctor at codehaus.org
Wed Nov 26 14:35:46 EST 2008
Amit Mhatre wrote:
> hi, I was facing similar issues some time back, though I was using a
> ruleflow and had >20000 fact objects evaluated daily. The problem I
> was facing was that the running time would get significantly slower
> day by day. The solution that fixed it was to use a statefulSession
> and call dispose() on the session once it is done. This made a
> single-run slower than before, but atleast fixed the problem of
> exponentially increasing the run-time after several days.
This sounds like a bug. Stateless session should definitely not get
repeatedly slower - as it's really just conenience wrapper around a
stateful session.
>
> This might not necessarily be the ideal solution, so before you move
> to a StatefulSession and call session.dispose() after processing, you
> might want to try to increase the memory for the jvm, if is lower than
> the size of your facts, this might fix it.
Maybe someone can review the stateless session code and try and find
where the memory leak is coming from?
>
> It'd be useful to know if somebody has a better solution to Kris's
> problem.
>
> Thanks,
> - am
>
>
> On Wed, Nov 26, 2008 at 9:35 AM, Kris Nuttycombe
> <kris.nuttycombe at gmail.com <mailto:kris.nuttycombe at gmail.com>> wrote:
>
> Hi, all,
>
> I'm encountering significant problems with running out of memory
> when executing a small ruleset (only 16 rules, < 100 facts). I've
> run jmap on the process (which has previously spawned multiple
> stateless sessions in parallel) and it looks like Drools, and
> specifically the Eclipse jdt compiler, is seriously eating up
> memory. The code calling the is fairly simple; one of the initial
> facts is an accumulator that I refer to later:
>
> StatelessSession session = ruleBase.newStatelessSession();
> session.execute(initialFact, accumulator);
>
> accumulator.doSomething();
>
> where ruleBase is a shared instance, and initialFact is a base
> fact that is expanded during rules processing. Is there something
> I should be doing to dispose the session after use to release the
> objects created by the drools compiler after use? I'm using a
> shared RuleBase, and I'm wondering whether it is somehow keeping
> references around. Are these sorts of object counts to be expected?
>
> Thanks,
>
> Kris
>
>
> Instance Counts for All Classes (excluding platform)
>
> 104827 instances
> <http://carrot.gaiam.com:7000/instances/0x2aaacf5646f8> of class
> net.jxta.impl.document.LiteXMLElement$charRange
> <http://carrot.gaiam.com:7000/class/0x2aaacf5646f8>
> 26806 instances
> <http://carrot.gaiam.com:7000/instances/0x2aaacf5631e8> of class
> net.jxta.impl.document.LiteXMLElement$tagRange
> <http://carrot.gaiam.com:7000/class/0x2aaacf5631e8>
> 26733 instances
> <http://carrot.gaiam.com:7000/instances/0x2aaad66ea7f0> of class
> org.eclipse.jdt.internal.compiler.lookup.MethodBinding
> <http://carrot.gaiam.com:7000/class/0x2aaad66ea7f0>
> 17366 instances
> <http://carrot.gaiam.com:7000/instances/0x2aaad66e3c88> of class
> [Lorg.eclipse.jdt.internal.compiler.lookup.TypeBinding;
> <http://carrot.gaiam.com:7000/class/0x2aaad66e3c88>
> 12412 instances
> <http://carrot.gaiam.com:7000/instances/0x2aaacf032560> of class
> com.sun.enterprise.loader.EJBClassLoader$SentinelInputStream
> <http://carrot.gaiam.com:7000/class/0x2aaacf032560>
> 10974 instances
> <http://carrot.gaiam.com:7000/instances/0x2aaad5504450> of class
> org.apache.commons.collections.SequencedHashMap$Entry
> <http://carrot.gaiam.com:7000/class/0x2aaad5504450>
> 8683 instances
> <http://carrot.gaiam.com:7000/instances/0x2aaad68c3840> of class
> org.eclipse.jdt.internal.compiler.codegen.CachedIndexEntry
> <http://carrot.gaiam.com:7000/class/0x2aaad68c3840>
> 7708 instances
> <http://carrot.gaiam.com:7000/instances/0x2aaacf55e9d8> of class
> net.jxta.impl.document.LiteXMLElement
> <http://carrot.gaiam.com:7000/class/0x2aaacf55e9d8>
> 7450 instances
> <http://carrot.gaiam.com:7000/instances/0x2aaad5c4b6c0> of class
> org.hibernate.engine.CollectionKey
> <http://carrot.gaiam.com:7000/class/0x2aaad5c4b6c0>
> 6836 instances
> <http://carrot.gaiam.com:7000/instances/0x2aaaced3c3f8> of class
> org.netbeans.modules.schema2beans.AttrProp
> <http://carrot.gaiam.com:7000/class/0x2aaaced3c3f8>
> 6271 instances
> <http://carrot.gaiam.com:7000/instances/0x2aaad6642d18> of class
> org.eclipse.jdt.internal.compiler.lookup.FieldBinding
> <http://carrot.gaiam.com:7000/class/0x2aaad6642d18>
> 5643 instances
> <http://carrot.gaiam.com:7000/instances/0x2aaad6796890> of class
> org.eclipse.jdt.internal.compiler.ast.MessageSend
> <http://carrot.gaiam.com:7000/class/0x2aaad6796890>
> 4928 instances
> <http://carrot.gaiam.com:7000/instances/0x2aaad68a6018> of class
> org.eclipse.jdt.internal.compiler.util.HashtableOfObject
> <http://carrot.gaiam.com:7000/class/0x2aaad68a6018>
> 4895 instances
> <http://carrot.gaiam.com:7000/instances/0x2aaad66e3fa8> of class
> [Lorg.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
> <http://carrot.gaiam.com:7000/class/0x2aaad66e3fa8>
> 4546 instances
> <http://carrot.gaiam.com:7000/instances/0x2aaad669f968> of class
> org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding
> <http://carrot.gaiam.com:7000/class/0x2aaad669f968>
> 4472 instances
> <http://carrot.gaiam.com:7000/instances/0x2aaad687a0a8> of class
> [Lorg.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
> <http://carrot.gaiam.com:7000/class/0x2aaad687a0a8>
> 4128 instances
> <http://carrot.gaiam.com:7000/instances/0x2aaad6103ff0> of class
> org.drools.rule.Pattern
> <http://carrot.gaiam.com:7000/class/0x2aaad6103ff0>
> 3899 instances
> <http://carrot.gaiam.com:7000/instances/0x2aaacf493c90> of class
> net.jxta.impl.id.UUID.UUID
> <http://carrot.gaiam.com:7000/class/0x2aaacf493c90>
> 3867 instances
> <http://carrot.gaiam.com:7000/instances/0x2aaad5c416c0> of class
> org.hibernate.engine.EntityEntry
> <http://carrot.gaiam.com:7000/class/0x2aaad5c416c0>
> 3731 instances
> <http://carrot.gaiam.com:7000/instances/0x2aaad5c54d88> of class
> org.hibernate.collection.PersistentSet
> <http://carrot.gaiam.com:7000/class/0x2aaad5c54d88>
> 3685 instances
> <http://carrot.gaiam.com:7000/instances/0x2aaad66ca420> of class
> org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding
> <http://carrot.gaiam.com:7000/class/0x2aaad66ca420>
> 3360 instances
> <http://carrot.gaiam.com:7000/instances/0x2aaad6c12770> of class
> org.drools.reteoo.SingleTupleSinkAdapter
> <http://carrot.gaiam.com:7000/class/0x2aaad6c12770>
> 3266 instances
> <http://carrot.gaiam.com:7000/instances/0x2aaacf543dc0> of class
> net.jxta.document.MimeMediaType
> <http://carrot.gaiam.com:7000/class/0x2aaacf543dc0>
> 3264 instances
> <http://carrot.gaiam.com:7000/instances/0x2aaad6370288> of class
> org.drools.spi.PatternExtractor
> <http://carrot.gaiam.com:7000/class/0x2aaad6370288>
> 3163 instances
> <http://carrot.gaiam.com:7000/instances/0x2aaad5f8b990> of class
> org.apache.axis.encoding.TypeMappingImpl$Pair
> <http://carrot.gaiam.com:7000/class/0x2aaad5f8b990>
> 3137 instances
> <http://carrot.gaiam.com:7000/instances/0x2aaad5caad98> of class
> org.hibernate.collection.PersistentBag
> <http://carrot.gaiam.com:7000/class/0x2aaad5caad98>
> 2881 instances
> <http://carrot.gaiam.com:7000/instances/0x2aaad681b000> of class
> org.eclipse.jdt.internal.compiler.lookup.MethodScope
> <http://carrot.gaiam.com:7000/class/0x2aaad681b000>
> 2688 instances
> <http://carrot.gaiam.com:7000/instances/0x2aaad6161860> of class
> org.drools.base.ClassFieldExtractor
> <http://carrot.gaiam.com:7000/class/0x2aaad6161860>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org <mailto:rules-users at lists.jboss.org>
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
> --
> I'm worst at what I do best, and for this gift I feel blessed
> -- Kurt Cobain
> ------------------------------------------------------------------------
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20081126/80ac9713/attachment.html
More information about the rules-users
mailing list