Re: [rules-users] Memory usage tied to rule report?
Edson, I'm using yEd for the graph viewer and tgf as the format for the graph. Here is the mvel template to produce the tgf file. I left the topten name the same for now. Did I miss any nodes or edges? @declare{topten} @code{ buffer = new StringBuilder(); for (ni : session.nodeInfos) { buffer.append( ni.id); buffer.append( ); buffer.append( ni.node); buffer.append( \r\n); } buffer.append( #\r\n); for (node : session.nodeInfos) { for (child : node.sinkList) { buffer.append( node.id); buffer.append( ); buffer.append( child.id); buffer.append( \r\n); } } } @{buffer.toString()} @end{} I would like to change the toString representations for all of the classes used in the graph. I there a better structure than a bunch of instanceof tests? (Would they even work?) if (ni.node instanceof AlphaNode) { buffer.append(A: ); if (ni.node.constraint instanceof ...) { Thanks again for your help. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Memory-usage-tied-to-rule-report-tp1434387p1649379.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Memory usage tied to rule report?
Hi Jared, This was really a first attempt at getting something useful to look inside the chest of a session and extract useful info. Feel free to look at the classes and propose changes/provide patches. Once it reaches a state we consider good enough, we can publish it in Drools API. Regarding use of instanceof, I always prefer to use polymorphism instead. So, define a method to do what you need in a super class/interface and we implement it in all subclasses. Besides making the code cleaner, this also makes sure that new nodes/classes created in the future will not break or be absent in the report. Edson 2010/10/7 Jared Davis sun...@davisprogramming.com: Edson, I'm using yEd for the graph viewer and tgf as the format for the graph. Here is the mvel template to produce the tgf file. I left the topten name the same for now. Did I miss any nodes or edges? @declare{topten} @code{ buffer = new StringBuilder(); for (ni : session.nodeInfos) { buffer.append( ni.id); buffer.append( ); buffer.append( ni.node); buffer.append( \r\n); } buffer.append( #\r\n); for (node : session.nodeInfos) { for (child : node.sinkList) { buffer.append( node.id); buffer.append( ); buffer.append( child.id); buffer.append( \r\n); } } } @{buffer.toString()} @end{} I would like to change the toString representations for all of the classes used in the graph. I there a better structure than a bunch of instanceof tests? (Would they even work?) if (ni.node instanceof AlphaNode) { buffer.append(A: ); if (ni.node.constraint instanceof ...) { Thanks again for your help. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Memory-usage-tied-to-rule-report-tp1434387p1649379.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Memory usage tied to rule report?
Edson, Thanks for the report. The top ten on the left was just what I needed to track down the badly written rules. The 385 rules generate 823 documents using 2 facts. My peak heap usage is now only 250mb. Before it would fail with a 1.2GB heap. Do you think this report is a good starting point to generate a graphML file showing the same info as the text report? Jared -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Memory-usage-tied-to-rule-report-tp1434387p1634480.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Memory usage tied to rule report?
Jared, Glad to hear. Yes, the idea of the API is to extract info from the working memory and RETE network and expose it to report generation. As you saw, I am using an MVEL template to generate the report at the moment. It is very crude, so any suggestions for improvements are most welcome. Once we get something better, we can expose it as an official API in Drools API. Edson 2010/10/5 Jared Davis sun...@davisprogramming.com: Edson, Thanks for the report. The top ten on the left was just what I needed to track down the badly written rules. The 385 rules generate 823 documents using 2 facts. My peak heap usage is now only 250mb. Before it would fail with a 1.2GB heap. Do you think this report is a good starting point to generate a graphML file showing the same info as the text report? Jared -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Memory-usage-tied-to-rule-report-tp1434387p1634480.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Memory usage tied to rule report?
Jared, Which version of Drools are you using? Drools 5.1 massively reduces memory consumption for long-running stateful sessions, when there are lots of update/modify calls, when compared to Drools 5.0. Also, in 5.1 there is an internal report you can run. I did not exposed this in drools-api yet, because I am still not happy with the overall API... so, maybe you can try using it and provide feedback on how you would improve it and we may eventually publish it on the next version. Anyway, to use it, after you have your session loaded with some data: SessionInspector inspector = new SessionInspector( ksession ); StatefulKnowledgeSessionInfo info = inspector.getSessionInfo(); SessionReporter.addNamedTemplate( topten, getClass().getResourceAsStream( customreports.mvel ) ); String report = SessionReporter.generateReport( topten, info, null ); The file referenced above (customreports.mvel) can be found here: http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/util/debug/customreports.mvel Just add it to your classpath. Feel free to change it as you see fit, but as is it will give you the top ten left and right node memories. Edson 2010/9/7 Jared Davis sun...@davisprogramming.com: Hi, I'm attempting to track down an out of memory error. I have ~400 rules that operate on ~1 facts. One set of facts throws an out of memory error while other sets process w/o an error. It is easy to reproduce. When the system runs out of memory there are about 22,000,000 ReteTuple objects active. I assume I have a bad rule producing a large cross product. How do I find it? Is there an audit tool that will let me tie ReteTuple back to a specific rule? Regards, Jared Davis -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Memory-usage-tied-to-rule-report-tp1434387p1434387.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users