[rules-users] Delay between rule firing using Drools 5.6
We have a series of decision tables and for a particular set of decision table we see that for the first time when the rule is fired, there is a delay between the After Activation of Rule 1 and Before Activation of Rule 2. This happens only when the Rules are fired for the first time. Since there are 200 decision table rows each execution seems to take longer. The condition for the rules to fire is $if : facts() $fact : Fact(factType == XYZ) from $if.Fact $if.Fact is an array list which has 200 Fact objects. Does this iteration takes time? We use Drools 5.6 Any help would be great. - - Prashanth -- View this message in context: http://drools.46999.n3.nabble.com/Delay-between-rule-firing-using-Drools-5-6-tp4030203.html Sent from the Drools: User forum 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] Scaling Drools based application
Right now our hands are tied using multiple sessions as we have Rule flow to trigger various rules at different stages, but would give it a try. - - Prashanth -- View this message in context: http://drools.46999.n3.nabble.com/Scaling-Drools-based-application-tp4026792p4026820.html Sent from the Drools: User forum 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] Scaling Drools based application
Thanks Laune, would consider this though in the future implementations. Is there an effective way to replace evals since we have OR conditions where we end up using evals in decision tables. If I had to get rid of this, the only option I foresee is to split into individual rules. Does disabling JIT (just-in-time compilation), help in improving the Memory usage of Drools. - - Prashanth -- View this message in context: http://drools.46999.n3.nabble.com/Scaling-Drools-based-application-tp4026792p4026821.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Scaling Drools based application
We have an requirement to scale the implemented Drools Rule Engine to all states in United States. With respect to the current implementation we have around 50 decision tables which when packaged creates a 200 MB pkg file and another pkg around 150 MB. The request which the drools engine consumes is a 150 KB xml file which is marshalled and processed. We have a JBoss server configured with 4 GB of memory (heap size + permGen) and works well with processing 5 concurrent request. Any request beyond 5 leads to OutOfMemoryException Now we have to scale this application to process request from 45 states, so there will be state specific pkg files (350 MB of pkg file). Each pkg is different for each state. With all this, do we need to increase the memory as no of states * 4 GB. Is this assumption correct? Is there a better architecture to handle scaling of drools application. Any memory/performance tuning tricks would also be helpful. - - Prashanth -- View this message in context: http://drools.46999.n3.nabble.com/Scaling-Drools-based-application-tp4026792.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Usage of Drools Configuration Attributes
Anyone know what these options are for and does this configuration help in reducing the rule execution time and memory usage. I couldn't find much details on these option apart from few like maintainTMS and shareAlphaNodes. drools.maintainTms drools.assertBehaviour drools.logicalOverride drools.sequential drools.sequential.agenda drools.removeIdentities drools.shareAlphaNodes drools.shareBetaNodes drools.alphaNodeHashingThreshold drools.compositeKeyDepth drools.indexLeftBetaMemory drools.indexRightBetaMemory drools.consequenceExceptionHandler drools.mbeans Are there any optimal values to improve performance. - - Prashanth -- View this message in context: http://drools.46999.n3.nabble.com/Usage-of-Drools-Configuration-Attributes-tp4026793.html Sent from the Drools: User forum 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] Abstracting Rules using extends
The same issue has been reported by different people in the past with no response or resolution http://lists.jboss.org/pipermail/rules-users/2012-August/028384.html http://lists.jboss.org/pipermail/rules-users/2012-August/028384.html http://lists.jboss.org/pipermail/rules-users/2012-August/028384.html http://lists.jboss.org/pipermail/rules-users/2012-August/028384.html - - Prashanth -- View this message in context: http://drools.46999.n3.nabble.com/Abstracting-Rules-using-extends-tp4023217p4023274.html Sent from the Drools: User forum 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] Abstracting Rules using extends
Thanks David. Am working on 5.4.0.Final. I would test the same in 5.5.1. - - Prashanth -- View this message in context: http://drools.46999.n3.nabble.com/Abstracting-Rules-using-extends-tp4023217p4023277.html Sent from the Drools: User forum 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] Abstracting Rules using extends
Hi David, Here are the code to reproduce the issue. I have attached the Unit Testcase also along with this. Vehicles.java http://drools.46999.n3.nabble.com/file/n4023252/Vehicles.java Vehicle.java http://drools.46999.n3.nabble.com/file/n4023252/Vehicle.java test1.drl http://drools.46999.n3.nabble.com/file/n4023252/test1.drl SampleTest.java http://drools.46999.n3.nabble.com/file/n4023252/SampleTest.java I was trying to narrow down on this issue over the weekend and below is what I was able to figure out. Whenever a Rule has the enabled attribute set to false and a fact that matches that specific rule exist then we are getting the error described above. This error doesn't popup if the Rule is either enabled or if a fact doesn't match the Rules LHS. I wasn't able to share the actual code hence had to workaround to reproduce the same. Thanks Arul Prashanth - - Prashanth -- View this message in context: http://drools.46999.n3.nabble.com/Abstracting-Rules-using-extends-tp4023217p4023252.html Sent from the Drools: User forum 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] Abstracting Rules using extends
Hey Vincent, I am loading the knowledge base in an order so that parent rules exist before the child rules are loaded. Thanks, Arul Prashanth - - Prashanth -- View this message in context: http://drools.46999.n3.nabble.com/Abstracting-Rules-using-extends-tp4023217p4023253.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Abstracting Rules using extends
I have a Rule implementation as below which works as expected, here Vehicles() and RuleConstant are facts. /rule Rule|1 no-loop true when $CONSTANT : RuleConstant(); $vehicles : Vehicles(); $vehicle:Vehicle(modelYear 2000, type = $CONSTANT.SEDAN) from $vehicles.Vehicle; then $vehicle.setValue(100); update($vehicles); end / But am planning to abstract the rules in the below fashion so that we can reuse the LHS conditions which doesn't work and throws the below said Null Pointer Exception *BaseRule.drl* /package com.xyz.base rule Base|1 no-loop true enabled false when $CONSTANT : RuleConstant(); $vehicles : Vehicles(); then end / *CustomRule.drl* /package com.xyz.custom rule Custom|1 extends Base|1 no-loop true enabled true when $vehicle:Vehicle(modelYear 2000, type = $CONSTANT.SEDAN) from $vehicles.Vehicle; then $vehicle.setValue(100); update($vehicles); end rule Custom|2 extends Base|1 no-loop true enabled true when $vehicle:Vehicle(modelYear 2000, type = $CONSTANT.COUPE) from $vehicles.Vehicle; then $vehicle.setValue(100); update($vehicles); end/ *Exception:* Caused by: [Error: drools.update($vehicles): null] [Line: 1, Column: 1] at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:416) at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:143) at org.mvel2.ast.ASTNode.optimize(ASTNode.java:159) at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:115) at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85) at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:123) at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:116) at org.mvel2.MVEL.executeExpression(MVEL.java:930) at org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:101) at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1273) ... 33 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:1105) at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:987) at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:377) ... 42 more Caused by: java.lang.NullPointerException at org.drools.common.DefaultAgenda.createActivation(DefaultAgenda.java:569) at org.drools.reteoo.RuleTerminalNode.modifyLeftTuple(RuleTerminalNode.java:297) at org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateModifyChildLeftTuple(SingleLeftTupleSinkAdapter.java:246) at org.drools.reteoo.JoinNode.modifyLeftTuple(JoinNode.java:363) at org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateModifyChildLeftTuple(SingleLeftTupleSinkAdapter.java:272) at org.drools.reteoo.EvalConditionNode.modifyLeftTuple(EvalConditionNode.java:213) at org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateModifyChildLeftTuple(SingleLeftTupleSinkAdapter.java:259) at org.drools.reteoo.FromNode.checkConstraintsAndPropagate(FromNode.java:337) at org.drools.reteoo.FromNode.modifyLeftTuple(FromNode.java:281) at org.drools.reteoo.CompositeLeftTupleSinkAdapter.propagateModifyChildLeftTuple(CompositeLeftTupleSinkAdapter.java:316) at org.drools.reteoo.JoinNode.modifyRightTuple(JoinNode.java:273) at org.drools.reteoo.BetaNode.modifyObject(BetaNode.java:531) at org.drools.reteoo.JoinNode.modifyObject(JoinNode.java:446) at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateModifyObject(CompositeObjectSinkAdapter.java:507) at org.drools.reteoo.CompositeObjectSinkAdapter.propagateModifyObject(CompositeObjectSinkAdapter.java:432) at org.drools.reteoo.ObjectTypeNode.modifyObject(ObjectTypeNode.java:314) at org.drools.reteoo.EntryPointNode.modifyObject(EntryPointNode.java:265) at org.drools.common.NamedEntryPoint.update(NamedEntryPoint.java:470) at org.drools.common.NamedEntryPoint.update(NamedEntryPoint.java:370) at org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:317) at org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:329) at org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:325) ... 49 more - - Prashanth -- View this message in context
Re: [rules-users] Abstracting Rules using extends
Thanks Laune for your insight. 1. The idea of having RuleConstant in the workingMemory is that the constants are defined in a drl and is being inserted into the working memory by a high salience rule. This is to reduce the effort in actual application build and deployment rather just package the rules and place the PKG file. On a longer run the rules will be maintained by a different team who prefer working only in DRL's and not in java files . I did considering them to be access as Global variables but wheren't able to access in LHS. Hence reverted back to adding them in working memory. /declare RuleConstant COUPE: String = C; SEDAN: String = S; end/ 2. We did consider having the Vehicle object as fact but there were requirements that required us to move back and forth a list of vehicles, like if a vehicle is 2011 and previous vehicle is 1999 where vehicles are ordered by purchase date compute X = Y. Though the below example doesn't show case this scenario. - - Prashanth -- View this message in context: http://drools.46999.n3.nabble.com/Abstracting-Rules-using-extends-tp4023217p4023219.html Sent from the Drools: User forum 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] Abstracting Rules using extends
Thanks Davide. 1. I did try making them in the same package but still am facing the same issue. I surfaced some posts that said like it works when converted as a pkg file rather than DRL. Not sure if this is correct. I could not get this working either ways. 2. Thanks for indicating me about creating enum in declare clause. This could help me refining a lot. - - Prashanth -- View this message in context: http://drools.46999.n3.nabble.com/Abstracting-Rules-using-extends-tp4023217p4023221.html Sent from the Drools: User forum 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] Abstracting Rules using extends
David, below are the content of the DRL's and have attached the full error trace herewith. error.txt http://drools.46999.n3.nabble.com/file/n4023225/error.txt *Base DRL* /package com.poc.test; declare Test1 code : String; end ruleflow-group FLOW1 rule INITIALIZE|test salience 99 when then insert(new Test1()); end rule BASE|5.1 enabled false dialect java when $test : Test1(); $vehicles : Vehicles(); $vehicle : Vehicle() from $vehicles.Vehicle; then // do nothing, extending rule to implement end/ *Custom DRL* / package com.poc.test; ruleflow-group FLOW1 rule TX|5.1 extends BASE|5.1 dialect mvel when //use base condition then // some update update($vehicles); end/ - - Prashanth -- View this message in context: http://drools.46999.n3.nabble.com/Abstracting-Rules-using-extends-tp4023217p4023225.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Update Fact in RuleFlow Action
Hi all, I have a requirement where in the fact will be updated in Flow 1 and the updated value needs to be used in Flow 2. Is there way wherein I can update the working memory in a Action block of RuleFlow between Flow1 and Flow2 as modify(fact) in Flow1 re-triggers the rules again in Flow1. I had a look at these updates to Rule flow api but not sure how I could get hold of the working memory and update the fact. update(fact) doesn't work in ruleflowhttps://issues.jboss.org/browse/BRMS-178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel ( https://issues.jboss.org/browse/BRMS-178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel ) Thanks, Prashanth ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Guvnor: Rules compilation error
Hi, In-spite of having the jar loaded, and having them available in the Drools Guvnor and able to write rules with “zero ” errors in verification, Rule compilation fails during validation after writing rules, says “Cannot resolve classname” for all those classes that have been imported and available to write rules Classes have been referred with their fully qualified class-names too. I request help to resolve this problem. Thanks and Regards Prashanth -- View this message in context: http://drools.46999.n3.nabble.com/Guvnor-Rules-compilation-error-tp3395529p3395529.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users