Re: [rules-users] Too many ACTIVATION candidates
Swindells, Thomas wrote: Your problem is you have a series of 5 facts which have no dependent constraints between them, the constraint is only applied by the last fact and even that isn't constraining as it involves ors not ands (if there is a fact 5 that matches then every combination of valid facts1-4 would be included). Indeed that is the issue. In my case, the facts 1...5 are not related and the only constraint is specified at the last fact. I'd say that this rule should actually be written as 16 rules - one for each of the or'd together GoodsItems conditions, each of these rules would only depend on a single Fact and you won't get into this problem. True. This rule can be re-written as a series of 5 rules that do not exhibit the explosion of activation candidates. I have done so and everything worked fine. Who controls the custom interface? If you can control then the simplest solution is to prevent them doing or's of conditions (though perhaps this may not fly with your customers). Alternatively have the interface output an intermediate form which you can then control the compilation of. The custom interface, you may think of it as a simplified Guvnor, is under my total control as I've implemented it. The problem is, that the user can use it to write these kinds of rules. In theory, rule rewriting could be possible, but I'm not sure I can detect these kinds of dependencies for any kind of rule that may be written. It there is a way that these kinds of cartesian product of activation candidates can be estimated before hand (either by analyzing the rule or by some other means), it would be great. Any ideas are welcomed. -Stathis Thomas. -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users- boun...@lists.jboss.org] On Behalf Of rou...@di.uoa.gr Sent: 22 December 2010 17:05 To: Wolfgang Laun Cc: Rules Users List Subject: Re: [rules-users] Too many ACTIVATION candidates Wolfgang Laun wrote: Are the constraints c9 == R true for all Facts of type fact1,...fact5? Is this actually the only constraint? For the example rule I have posted, this is the only constraint. The equality test for R, in that case does not really prune the facts a lot. The numbers I have posted are roughly correct. The not doesn't really reduce the network since it is the last pattern. Indeed. I have found this to be true the hard way! I'll wait for your answer before proposing a solution. Please, take into consideration the general case for this kind of problem. I know that the particular rule I have posted can be re-written as a series of 5 rules that each one test for a single fact. I have done so for this particular rule and there was no issue getting a result. The problem is, that I do not have direct control over the rules, the users write them (through a custom interface). So I am actually wondering if there is a way to foresee these kinds of problems without actually executing the rules. Thank you for your time, -Stathis -W On 22 December 2010 15:34, rou...@di.uoa.gr wrote: Hello List, Issue: Too many ACTIVATION candidates Sorry for the terminology, I'm sure it is not correct. Background Information: - Drools.5.0.1 - using StatefulKnowledgeSession - logging through KnowledgeRuntimeLoggerFactory.newConsoleLogger() - after each session creation, rules are inserted from a DRL file, facts are inserted and ksession.fireAllRules() is executed - str[contains] and str[bidicontains] are custom operators implemented by me If I understand Drools modus operandi correctly, as each fact is inserted the list of candidate nodes to fire are constructed. Upon fireAllRules(), a selection mechanism selects a candidate node to fire and things start rolling. In my case, the rule at the end results in too many candidate nodes created during facts insertion mode. If the rule ever gets to fire, only one will remain since the not codition in the LHS and the logicalInserts in the RHS exclude two firings of the rule (I hope). fact1 has about 90 entries. fact2 has about 25 entries. fact3 has about 350 entries. fact4 has about 150 entries. fact5 has about 250 entries. So I'm guessing that 90*25*350*150*250=29.531.250.000, i.e. 29 billion candidate nodes would be created. Of course, I'm having OME long before that! If my analysis is correct, is any way that I could either: a) detect that kind of combinatorial explosion during runtime (maybe a kind of dry-run) and act accordingly or b) set any kind of upper limit for candidate nodes creation and stop further execution thus avoiding to bring down the server along the way... rule r21767.2 dialect mvel when gnId : GoodNumbers() v1 : fact1( c21658 == R ) v2 : fact2( c21727 == R ) v3 :
Re: [rules-users] Too many ACTIVATION candidates
I'd say that this rule should actually be written as 16 rules - one for each of the or'd together GoodsItems conditions, each of these rules would only depend on a single Fact and you won't get into this problem. True. This rule can be re-written as a series of 5 rules that do not exhibit the explosion of activation candidates. I have done so and everything worked fine. Who controls the custom interface? If you can control then the simplest solution is to prevent them doing or's of conditions (though perhaps this may not fly with your customers). Alternatively have the interface output an intermediate form which you can then control the compilation of. The custom interface, you may think of it as a simplified Guvnor, is under my total control as I've implemented it. The problem is, that the user can use it to write these kinds of rules. In theory, rule rewriting could be possible, but I'm not sure I can detect these kinds of dependencies for any kind of rule that may be written. No, I think they should be rewritten as a series of 16 rules (one for each '||'. You could remove the option from the user of being able to 'or' together conditions and require each thing to be written as separate rules. This should reduce the Cartesian products for the majority of cases (although creative users could still possibly write statements like (fact1 != thiswillneverhappen fact2 != thiswillneverhappen2...)/ It there is a way that these kinds of cartesian product of activation candidates can be estimated before hand (either by analyzing the rule or by some other means), it would be great. Any ideas are welcomed. It depends on how accurate you want it. Simplist option is to restrict the number of facts that a rule can match against (if they can only match against 3 facts the Cartesian product probably isn't too bad). Slightly more complicated you can assume the worst case scenario that every value of each fact type is included and multiple the count of each included fact together, if it exceeds a configured limit you decide that potentially the rule is too complicated. Getting much more complicated is to perform a much more accurate estimation of each fact based upon the constraints. You could either do this in code (perhaps a db query or some other way to apply the constraint). Another way to do this would be to decompose the rules so that you accumulate the result of each fact constraint first, check whether too many facts have been included and then use a from for each accumulation at the end (or something like that anyway). Thomas ** This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmas...@nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary. NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00 ** ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools Flow Fluent API Help
Hi There.. What version of Drools are you using? I can help you to figure out what is happening.. 2010/12/23 Dan Nathanson d...@ddnconsulting.com Hi, I've been banging my head against this for days and just can't get it to work. At this point I'd like to just get the example code working. I've got a simple class that is currently being driven by a JUnit test case. I just want to create a Process flow and execute it. I don't care what it does at this point. Hello world level stuff. My method under test: public String runFlow() throws Exception { RuleFlowProcessFactory factory = RuleFlowProcessFactory.createProcess(org.drools.process); factory // header .name(My process).packageName(org.drools) // nodes .startNode(1).name(Start).done() .actionNode(2).name(Action) .action(java, System.out.println(\Hello World\);).done() .endNode(3).name(End).done() // connections .connection(1, 2) .connection(2, 3); RuleFlowProcess process = factory.validate().getProcess(); KnowledgeBase knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase(); KnowledgeBuilder builder = KnowledgeBuilderFactory.newKnowledgeBuilder(knowledgeBase); Package pkg = new Package(package1); pkg.addProcess(process); RuleBase ruleBase = RuleBaseFactory.newRuleBase(); ruleBase.addPackage(pkg); CollectionKnowledgePackage kpackages = builder.getKnowledgePackages(); KnowledgePackage kpackage = new KnowledgePackageImp(pkg); kpackages.add(kpackage); knowledgeBase.addKnowledgePackages(kpackages); StatefulKnowledgeSession ksession = knowledgeBase.newStatefulKnowledgeSession(); KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newConsoleLogger(ksession); ksession.startProcess(org.drools.process); return foo; } When I run this process, I get an exception when the Action node is run. It is a NPE and it happens because the metaData map in the underlying ActionNode does not contain a KVP for Action. It looks like that KVP is added in in the DroolsAction class when the public void wire(Object object) method is called. Unfortunately, I can't figure out what causes that method to be called. I'm pretty sure my problem is with the set up of my knowledge base (the call to new KnowledgePackageImp() is suspect), but I can't figure out how to set up the knowledge base when building a RuleFlowProcess using the RuleFlowProcessFactory. None of the examples I can find show how to do this. Note that if I take out the Action node and just have Start and End nodes, it works fine. I am using Drools 5.1.0, but it doesn't work with Drools 5.0.1 either. Any help would be appreciated. The flat spot on my forehead is getting flatter every day I continue to bang my head against the wall. Here's the output (including KnowledgeRuntimeLogger output): BEFORE RULEFLOW STARTED process:My process[id=org.drools.process] BEFORE RULEFLOW NODE TRIGGERED node:Start[id=1] process:My process[id=org.drools.process] null process:My process[id=org.drools.process] BEFORE RULEFLOW NODE TRIGGERED node:Action[id=2] process:My process[id=org.drools.process] java.lang.RuntimeException: unable to execute Action at org.drools.workflow.instance.node.ActionNodeInstance.internalTrigger(ActionNodeInstance.java:56) at org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:117) at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:178) at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:144) at org.drools.workflow.instance.node.StartNodeInstance.triggerCompleted(StartNodeInstance.java:49) at org.drools.workflow.instance.node.StartNodeInstance.internalTrigger(StartNodeInstance.java:41) at org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:117) at org.drools.ruleflow.instance.RuleFlowProcessInstance.internalStart(RuleFlowProcessInstance.java:32) at org.drools.process.instance.impl.ProcessInstanceImpl.start(ProcessInstanceImpl.java:192) at org.drools.workflow.instance.impl.WorkflowProcessInstanceImpl.start(WorkflowProcessInstanceImpl.java:309) at org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1644) at org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1622) at org.drools.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:301) at com.proferi.epm.process.DroolsFlowManager.runFlow(DroolsFlowManager.java:75) at
Re: [rules-users] drools from database
Did you try with the documentation?? http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/html_single/index.html#d0e6174 There is a whole section for templates :) On Thu, Dec 23, 2010 at 2:49 AM, wasim.khan318 khanwasi...@yahoo.co.inwrote: sir please give me any example or link so that i can implement it -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/drools-from-database-tp2130575p2135152.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 -- - CTO @ http://www.plugtree.com - MyJourney @ http://salaboy.wordpress.com - Co-Founder @ http://www.jbug.com.ar - Salatino Salaboy Mauricio - ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] drools from database
On 23/12/2010 05:49, wasim.khan318 wrote: sir please give me any example or link so that i can implement it I've read the thread on this, i think you need to grasp the basics to drools first and then come back with more specific questions. Try going over all the examples. Then you can either insert facts directly with hibernate or you can pull via from and a hibernate named query. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Redeployment classloading problem in SOA Platform using Guvnor
Hey guys. We use the SOA-Platform stack but have a problem when redeploying a resource, using Drools, see: http://community.jboss.org/thread/160350. Anybody an idea to this? Looks a bit like a drools bug to me, that something somewhere keeps a reference to undeployed classes? Thanks in advance Bernd ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] help with diagnosing CEP performance issue
Hi. im trying to demo drools-fusion for a system that processes backup events. i have the following 2 CEP rules: rule Backup Not Succeeded For At Least 3 Days @ruleId(1) when Node($id : id) not ( Backup(clientId == $id, $state: state == BackupStateEnum.FINISHED) over window:time( 3d ) from entry-point Backup Stream ) then //nothing for now end rule Prune Previous Successful Backups @ruleId(2) when $prevBackup : Backup($id : clientId, state == BackupStateEnum.FINISHED) from entry-point Backup Stream $newerBackup : Backup(clientId == $id, state == BackupStateEnum.FINISHED, this after $prevBackup) from entry-point Backup Stream then drools.retract($prevBackup); end rule #2 is my attempt to cut down on memory usage. the problem is that rule #2 slows down the processing very very considerably (2 orders of magnitude slower when simulating batches of 40K events/day). what would be my next step in trying to find the reason for it? my intuition tells me that with 2 events in the system at any given time instead of 120K (single node, 40K events/day 3 day window) i should have seen either a speedup or reduced memory consumption (if not both) and yet the results im seeing are the exact opposite. is there anything im missing ? i could try adding some sort of LastSuccessfulBackup marker object into main memory and updating it using events from the backup stream, but then how would i express rule #1 ? any help/clues/suggestions would be greatly appreciated, radai. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools Flow Fluent API Help
I am using Drools 5.1.0, but it doesn't work with Drools 5.0.1 either. I'm pretty sure I must be missing a step when going from DroolsFlowProcess -- StatefulKnowledgeSession, but I can't figure it out. I'm probably getting one of the intermediate classes incorrectly. Probably calling a constructor when I should be using a factory method, or something like that. Regards, Dan Nathanson On Dec 23, 2010, at 3:10 AM, Mauricio Salatino wrote: I am using Drools 5.1.0, but it doesn't work with Drools 5.0.1 either. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Unable to validate package configuration (eg, DSLs, models) for [package name]
Hi, We recently upgraded from Drools/Guvnor 5.0.1 to 5.1.1 (early December). We had an existing package we had developed in 5.0.1 that we had not done much with since the upgrade. This morning, we tried to open one of the rules in that package and we get the following messages: Picture (Device Independent Bitmap) Unable to validate package configuration (eg, DSLs, models) for [package name]. Suggestion completions may not operate correctly for graphical editors for this package. Picture (Device Independent Bitmap) Unable to get content assistance for this rule. Picture (Device Independent Bitmap) Unable to get content assistance for this rule. I've tried to re-upload the 3 jar files (I saw this post as a possible solution: http://comments.gmane.org/gmane.comp.java.drools.user/23407), but I get Unable to upload the file. New packages seem to be okay (e.g. packages created since the upgrade). Does anyone have any thoughts on what's going on here? Thanks. ole0.bmpole1.bmpole2.bmp___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Integration Of Guvnor with CustomApp
Hello All, I am able to successfully integrate Guvnor into my custom app. (based on spring) ( http://drools-java-rules-engine.46999.n3.nabble.com/How-to-integrate-Guvnor-GUI-in-a-test-app-td1595617.html ) I have written some code in the index.jsp which invokes the ServiceImplementation of Guvnor. I am observing that RuleRepository object is coming as null. Note: Through the integrated app If I hit the Guvnor URL than it is working as normal. private ServiceImplementation getService() { ServiceImplementation impl = new ServiceImplementation(); RulesRepository repository = impl.getRulesRepository(); return impl; } What is the suggested way of using the Guvnor services from the jsp/java ? ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Integration Of Guvnor with CustomApp
Andrew Waterman and Jervis Liu were working on a REST API for Guvnor: https://issues.jboss.org/browse/GUVNOR-1080 Maybe you can help them. In the other hand, I have implemented a way to embedd Guvnor's editors in external applications: http://ilesteban.wordpress.com/2010/11/23/guvnor-embed-assets-editor-in-your-application/ Best Regards, Esteban Aliverti - Developer @ http://www.plugtree.com - Blog @ http://ilesteban.wordpress.com 2010/12/23 Harshit Bapna hrba...@gmail.com Hello All, I am able to successfully integrate Guvnor into my custom app. (based on spring) ( http://drools-java-rules-engine.46999.n3.nabble.com/How-to-integrate-Guvnor-GUI-in-a-test-app-td1595617.html ) I have written some code in the index.jsp which invokes the ServiceImplementation of Guvnor. I am observing that RuleRepository object is coming as null. Note: Through the integrated app If I hit the Guvnor URL than it is working as normal. private ServiceImplementation getService() { ServiceImplementation impl = new ServiceImplementation(); RulesRepository repository = impl.getRulesRepository(); return impl; } What is the suggested way of using the Guvnor services from the jsp/java ? ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Integration Of Guvnor with CustomApp
Esteban I too am trying to integrate the Rule editing widget into my web page. I followed your writeup, very helpful indeed. What is missing though is a handy method to get all rules under a category. In my app (and I suspect in most cases where people are trying to embed the asset editor), we only want to retrieve those rules that belong to the category that the web user has access to. There seems to be no way of doing this in the REST API or the service classes built on top of RulesRepository. Thanks Ghanshyam From: Esteban Aliverti esteban.alive...@gmail.com To: Rules Users List rules-users@lists.jboss.org Date: 12/23/2010 09:54 AM Subject:Re: [rules-users] Integration Of Guvnor with CustomApp Sent by:rules-users-boun...@lists.jboss.org Andrew Waterman and Jervis Liu were working on a REST API for Guvnor: https://issues.jboss.org/browse/GUVNOR-1080 Maybe you can help them. In the other hand, I have implemented a way to embedd Guvnor's editors in external applications: http://ilesteban.wordpress.com/2010/11/23/guvnor-embed-assets-editor-in-your-application/ Best Regards, Esteban Aliverti - Developer @ http://www.plugtree.com - Blog @ http://ilesteban.wordpress.com 2010/12/23 Harshit Bapna hrba...@gmail.com Hello All, I am able to successfully integrate Guvnor into my custom app. (based on spring) ( http://drools-java-rules-engine.46999.n3.nabble.com/How-to-integrate-Guvnor-GUI-in-a-test-app-td1595617.html ) I have written some code in the index.jsp which invokes the ServiceImplementation of Guvnor. I am observing that RuleRepository object is coming as null. Note: Through the integrated app If I hit the Guvnor URL than it is working as normal. private ServiceImplementation getService() { ServiceImplementation impl = new ServiceImplementation(); RulesRepository repository = impl.getRulesRepository(); return impl; } What is the suggested way of using the Guvnor services from the jsp/java ? ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users - The information contained in this communication (including any attachments hereto) is confidential and is intended solely for the personal and confidential use of the individual or entity to whom it is addressed. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this communication in error and that any review, dissemination, copying, or unauthorized use of this information, or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. Thank you ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Integration Of Guvnor with CustomApp
So this is a wonderful situation to make a contribution ;) I think the functionality you are looking for should be easy to implement. Please ask Andrew about this. I'm sure he will be glad to help you. Best Regards, Esteban Aliverti - Developer @ http://www.plugtree.com - Blog @ http://ilesteban.wordpress.com 2010/12/23 gpa...@tsys.com Esteban I too am trying to integrate the Rule editing widget into my web page. I followed your writeup, very helpful indeed. What is missing though is a handy method to get all rules under a category. In my app (and I suspect in most cases where people are trying to embed the asset editor), we only want to retrieve those rules that belong to the category that the web user has access to. There seems to be no way of doing this in the REST API or the service classes built on top of RulesRepository. Thanks Ghanshyam From:Esteban Aliverti esteban.alive...@gmail.com To:Rules Users List rules-users@lists.jboss.org Date:12/23/2010 09:54 AM Subject:Re: [rules-users] Integration Of Guvnor with CustomApp Sent by:rules-users-boun...@lists.jboss.org -- Andrew Waterman and Jervis Liu were working on a REST API for Guvnor: * https://issues.jboss.org/browse/GUVNOR-1080*https://issues.jboss.org/browse/GUVNOR-1080 Maybe you can help them. In the other hand, I have implemented a way to embedd Guvnor's editors in external applications: * http://ilesteban.wordpress.com/2010/11/23/guvnor-embed-assets-editor-in-your-application/ *http://ilesteban.wordpress.com/2010/11/23/guvnor-embed-assets-editor-in-your-application/ Best Regards, Esteban Aliverti - Developer @ *http://www.plugtree.com * http://www.plugtree.com/ - Blog @ *http://ilesteban.wordpress.com*http://ilesteban.wordpress.com/ 2010/12/23 Harshit Bapna *hrba...@gmail.com* hrba...@gmail.com Hello All, I am able to successfully integrate Guvnor into my custom app. (based on spring) (* http://drools-java-rules-engine.46999.n3.nabble.com/How-to-integrate-Guvnor-GUI-in-a-test-app-td1595617.html *http://drools-java-rules-engine.46999.n3.nabble.com/How-to-integrate-Guvnor-GUI-in-a-test-app-td1595617.html ) I have written some code in the index.jsp which invokes the ServiceImplementation of Guvnor. I am observing that RuleRepository object is coming as null. Note: Through the integrated app If I hit the Guvnor URL than it is working as normal. private ServiceImplementation getService() { ServiceImplementation impl = new ServiceImplementation(); RulesRepository repository = impl.getRulesRepository(); return impl; } What is the suggested way of using the Guvnor services from the jsp/java ? ___ rules-users mailing list* **rules-us...@lists.jboss.org* rules-users@lists.jboss.org* **https://lists.jboss.org/mailman/listinfo/rules-users*https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users - The information contained in this communication (including any attachments hereto) is confidential and is intended solely for the personal and confidential use of the individual or entity to whom it is addressed. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this communication in error and that any review, dissemination, copying, or unauthorized use of this information, or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. Thank you ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] help with diagnosing CEP performance issue
(OT: your nick me is confusing other gmail users. I see your mail as if I had sent it to myself. I was almost binning it.) The delay you see may depend on the way you run the test with 40K events. Please describe the sequence of insertions and calls to fire...(), the session setup (pseudo-clock, etc.) -W 2010/12/23 me radai.rosenbl...@gmail.com Hi. im trying to demo drools-fusion for a system that processes backup events. i have the following 2 CEP rules: rule Backup Not Succeeded For At Least 3 Days @ruleId(1) when Node($id : id) not ( Backup(clientId == $id, $state: state == BackupStateEnum.FINISHED) over window:time( 3d ) from entry-point Backup Stream ) then //nothing for now end rule Prune Previous Successful Backups @ruleId(2) when $prevBackup : Backup($id : clientId, state == BackupStateEnum.FINISHED) from entry-point Backup Stream $newerBackup : Backup(clientId == $id, state == BackupStateEnum.FINISHED, this after $prevBackup) from entry-point Backup Stream then drools.retract($prevBackup); end rule #2 is my attempt to cut down on memory usage. the problem is that rule #2 slows down the processing very very considerably (2 orders of magnitude slower when simulating batches of 40K events/day). what would be my next step in trying to find the reason for it? my intuition tells me that with 2 events in the system at any given time instead of 120K (single node, 40K events/day 3 day window) i should have seen either a speedup or reduced memory consumption (if not both) and yet the results im seeing are the exact opposite. is there anything im missing ? i could try adding some sort of LastSuccessfulBackup marker object into main memory and updating it using events from the backup stream, but then how would i express rule #1 ? any help/clues/suggestions would be greatly appreciated, radai. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] help with diagnosing CEP performance issue
hehe yes.. the same happens to me :) 2010/12/23 Wolfgang Laun wolfgang.l...@gmail.com (OT: your nick me is confusing other gmail users. I see your mail as if I had sent it to myself. I was almost binning it.) The delay you see may depend on the way you run the test with 40K events. Please describe the sequence of insertions and calls to fire...(), the session setup (pseudo-clock, etc.) -W 2010/12/23 me radai.rosenbl...@gmail.com Hi. im trying to demo drools-fusion for a system that processes backup events. i have the following 2 CEP rules: rule Backup Not Succeeded For At Least 3 Days @ruleId(1) when Node($id : id) not ( Backup(clientId == $id, $state: state == BackupStateEnum.FINISHED) over window:time( 3d ) from entry-point Backup Stream ) then //nothing for now end rule Prune Previous Successful Backups @ruleId(2) when $prevBackup : Backup($id : clientId, state == BackupStateEnum.FINISHED) from entry-point Backup Stream $newerBackup : Backup(clientId == $id, state == BackupStateEnum.FINISHED, this after $prevBackup) from entry-point Backup Stream then drools.retract($prevBackup); end rule #2 is my attempt to cut down on memory usage. the problem is that rule #2 slows down the processing very very considerably (2 orders of magnitude slower when simulating batches of 40K events/day). what would be my next step in trying to find the reason for it? my intuition tells me that with 2 events in the system at any given time instead of 120K (single node, 40K events/day 3 day window) i should have seen either a speedup or reduced memory consumption (if not both) and yet the results im seeing are the exact opposite. is there anything im missing ? i could try adding some sort of LastSuccessfulBackup marker object into main memory and updating it using events from the backup stream, but then how would i express rule #1 ? any help/clues/suggestions would be greatly appreciated, radai. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- - CTO @ http://www.plugtree.com - MyJourney @ http://salaboy.wordpress.com - Co-Founder @ http://www.jbug.com.ar - Salatino Salaboy Mauricio - ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Too many ACTIVATION candidates
One way of detecting cartesian products is to model the LHS as a graph, with object patterns being nodes, and conditions that compare two objects being an edge. If the LHS graph has unconnected subgraphs then it contains a cartesian product. You can make this more sophisticated by excluding classes that you know have few instances in working memory, like control objects. GreG On Dec 23, 2010, at 3:37, Swindells, Thomas tswinde...@nds.com wrote: I'd say that this rule should actually be written as 16 rules - one for each of the or'd together GoodsItems conditions, each of these rules would only depend on a single Fact and you won't get into this problem. True. This rule can be re-written as a series of 5 rules that do not exhibit the explosion of activation candidates. I have done so and everything worked fine. Who controls the custom interface? If you can control then the simplest solution is to prevent them doing or's of conditions (though perhaps this may not fly with your customers). Alternatively have the interface output an intermediate form which you can then control the compilation of. The custom interface, you may think of it as a simplified Guvnor, is under my total control as I've implemented it. The problem is, that the user can use it to write these kinds of rules. In theory, rule rewriting could be possible, but I'm not sure I can detect these kinds of dependencies for any kind of rule that may be written. No, I think they should be rewritten as a series of 16 rules (one for each '||'. You could remove the option from the user of being able to 'or' together conditions and require each thing to be written as separate rules. This should reduce the Cartesian products for the majority of cases (although creative users could still possibly write statements like (fact1 != thiswillneverhappen fact2 != thiswillneverhappen2...)/ It there is a way that these kinds of cartesian product of activation candidates can be estimated before hand (either by analyzing the rule or by some other means), it would be great. Any ideas are welcomed. It depends on how accurate you want it. Simplist option is to restrict the number of facts that a rule can match against (if they can only match against 3 facts the Cartesian product probably isn't too bad). Slightly more complicated you can assume the worst case scenario that every value of each fact type is included and multiple the count of each included fact together, if it exceeds a configured limit you decide that potentially the rule is too complicated. Getting much more complicated is to perform a much more accurate estimation of each fact based upon the constraints. You could either do this in code (perhaps a db query or some other way to apply the constraint). Another way to do this would be to decompose the rules so that you accumulate the result of each fact constraint first, check whether too many facts have been included and then use a from for each accumulation at the end (or something like that anyway). Thomas ** This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmas...@nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary. NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00 ** ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users