[rules-users] Performance issue
Hi All, I have written a code to check the properties of a bean using drools based rules. I have created the different rules file where different properties of the bean will be checked. The code i have written is a as below: public static void check(Object details,String rule){ long methodStartTime=System.currentTimeMillis(); Resource resource = new ClassPathResource(RULE_CLASSPATH+rule); KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); long startTime=System.currentTimeMillis(); kbuilder.add(resource, ResourceType.DRL ); long endTime=System.currentTimeMillis(); System.out.println(Time taken in add resource in milli seconds is::+(endTime-startTime)); KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() ); KnowledgeBuilderErrors errors = kbuilder.getErrors(); if (errors.size() 0) { for (KnowledgeBuilderError error: errors) { System.err.println(error); } } StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession(); ksession.execute(details); long methodEndTime=System.currentTimeMillis(); System.out.println(Time taken in Method check in milli seconds is::+(methodEndTime-methodStartTime)); } Here in the check method we have three parameters details this is the bean whose properties need to be checked in rules file, rule this is the name of rules file which contains all the rules. Here the issue is that it takes around 4 seconds for the first time and 1 second for all consecutive requests, and 4 second looks too much time for validating the rules file that has only 10 rules. Please let me know we have some better way of doing it in drools -- View this message in context: http://drools.46999.n3.nabble.com/Performance-issue-tp4017688.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] Performance issue
The time for the first call isn't just for validating the DRL since you do this *every* time you call check. There's lots of things a Java program does behind the scenes, i.e., without explicitly initiated by the programmer. Calling the Builder with a DRL source file to check a single bean is extremely wasteful. Create the KnowledgeBase once and start sessions from that. Also, consider serializing the KnowledgeBase and loading it in separate runs (as described in the Expert manual). Also consider using a Stateful Knowledge Session into which multiple inserts are possible. -W On 31/05/2012, Ini inder...@gmail.com wrote: Hi All, I have written a code to check the properties of a bean using drools based rules. I have created the different rules file where different properties of the bean will be checked. The code i have written is a as below: public static void check(Object details,String rule){ long methodStartTime=System.currentTimeMillis(); Resource resource = new ClassPathResource(RULE_CLASSPATH+rule); KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); long startTime=System.currentTimeMillis(); kbuilder.add(resource, ResourceType.DRL ); long endTime=System.currentTimeMillis(); System.out.println(Time taken in add resource in milli seconds is::+(endTime-startTime)); KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() ); KnowledgeBuilderErrors errors = kbuilder.getErrors(); if (errors.size() 0) { for (KnowledgeBuilderError error: errors) { System.err.println(error); } } StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession(); ksession.execute(details); long methodEndTime=System.currentTimeMillis(); System.out.println(Time taken in Method check in milli seconds is::+(methodEndTime-methodStartTime)); } Here in the check method we have three parameters details this is the bean whose properties need to be checked in rules file, rule this is the name of rules file which contains all the rules. Here the issue is that it takes around 4 seconds for the first time and 1 second for all consecutive requests, and 4 second looks too much time for validating the rules file that has only 10 rules. Please let me know we have some better way of doing it in drools -- View this message in context: http://drools.46999.n3.nabble.com/Performance-issue-tp4017688.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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Performance issue
The first optimization I can advice (without knowing your rules) is to keep the kbase cached instead of being compiling the resources and creating it for each request. You can compile the resources with kbuilder once, create a kbase once and then for each request you only need to create a ksession from the already existing kbase and use it. The compilation of the rules is (usually) one of the most time-consuming tasks you have in drools. Best Regards, Esteban Aliverti - Developer @ http://www.plugtree.com - Blog @ http://ilesteban.wordpress.com On Thu, May 31, 2012 at 8:25 AM, Ini inder...@gmail.com wrote: Hi All, I have written a code to check the properties of a bean using drools based rules. I have created the different rules file where different properties of the bean will be checked. The code i have written is a as below: public static void check(Object details,String rule){ long methodStartTime=System.currentTimeMillis(); Resource resource = new ClassPathResource(RULE_CLASSPATH+rule); KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); long startTime=System.currentTimeMillis(); kbuilder.add(resource, ResourceType.DRL ); long endTime=System.currentTimeMillis(); System.out.println(Time taken in add resource in milli seconds is::+(endTime-startTime)); KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() ); KnowledgeBuilderErrors errors = kbuilder.getErrors(); if (errors.size() 0) { for (KnowledgeBuilderError error: errors) { System.err.println(error); } } StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession(); ksession.execute(details); long methodEndTime=System.currentTimeMillis(); System.out.println(Time taken in Method check in milli seconds is::+(methodEndTime-methodStartTime)); } Here in the check method we have three parameters details this is the bean whose properties need to be checked in rules file, rule this is the name of rules file which contains all the rules. Here the issue is that it takes around 4 seconds for the first time and 1 second for all consecutive requests, and 4 second looks too much time for validating the rules file that has only 10 rules. Please let me know we have some better way of doing it in drools -- View this message in context: http://drools.46999.n3.nabble.com/Performance-issue-tp4017688.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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Performance issue
Hi Esteban..Thanks for you reply ..As i am new to drools..can you please provide some code snippet for what you explained that will be really helpful. Thanks Ini -- View this message in context: http://drools.46999.n3.nabble.com/Performance-issue-tp4017688p4017691.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] Performance issue
Hi Laune, Thanks for you reply ..As i am new to drools..can you please provide some code snippet for what you explained that will be really helpful. Thanks Ini -- View this message in context: http://drools.46999.n3.nabble.com/Performance-issue-tp4017688p4017692.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] Looking for Drools audit tool
I am looking for something that can help me to detect the following errors: redundancies, subsumptions, equivalences, incoherent references... Thanks -- View this message in context: http://drools.46999.n3.nabble.com/Looking-for-Drools-audit-tool-tp4017686p4017693.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] Looking for Drools audit tool
drools-verifier is the usual suggestion for such things. It comes bundled with a set of validation\verification rules but you can add your own too. On 31 May 2012 08:42, paco fifi_nji...@yahoo.fr wrote: I am looking for something that can help me to detect the following errors: redundancies, subsumptions, equivalences, incoherent references... Thanks -- View this message in context: http://drools.46999.n3.nabble.com/Looking-for-Drools-audit-tool-tp4017686p4017693.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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Performance issue
Surely you don't need advice on how to split your method check into one preparing the KnowledgeBase and into another one creating and running sessions. As for the rest, consult the Expert documentation, Section 3.2, Deploying, (but others as well). -W On 31/05/2012, Ini inder...@gmail.com wrote: Hi Laune, Thanks for you reply ..As i am new to drools..can you please provide some code snippet for what you explained that will be really helpful. Thanks Ini -- View this message in context: http://drools.46999.n3.nabble.com/Performance-issue-tp4017688p4017692.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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Looking for Drools audit tool
Thank yyou very much. But can you tell me where can I find documentation and examples about Drools verifier? Thanks Paco -- View this message in context: http://drools.46999.n3.nabble.com/Looking-for-Drools-audit-tool-tp4017686p4017698.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] DRL to XML transformation
The XML format produced by XmlDumper is an XML representation of various internal Descriptors used by Drools Expert and only supports features up to 4.0 It is unfortunately not the same as that stored internally in Guvnor (which is simply a XStream representation of Guvnor's internal model). Furthermore Guvnor's internal representation is private and subject to change from release to release. There is no easy way to convert from one to the other, other than writing your own XSLT. With kind regards, Mike On 29 May 2012 13:36, Anirban Bandyopadhyay anirban.bandyopadh...@monitisegroup.com wrote: Hi, ** ** We have a set of rule files in DRL format. We couldn’t find a way (tool) of importing them into Guvnor as BRL file so that we can edit using the designer. ** ** We ended up using the DrlParser and XmlDumper to transform them from DRL to BRL. It produces the XML and when we add it to the repository using WebDav, Guvnor lists the files under Business Rule which is perfect. BUT when I try to open it, it throws the following error: ** ** com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$Unkno wnFieldException: No such field org.drools.ide.common.client.modeldriven.brl.Rul eModel.rule-attribute Debugging information field : rule-attribute class : org.drools.ide.common.client.modeldriven.brl.RuleModel required-type : org.drools.ide.common.client.modeldriven.brl.RuleModel converter-type : com.thoughtworks.xstream.converters.reflection.ReflectionC onverter path: /rule/rule-attribute version : null --- at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConv erter.determineType(AbstractReflectionConverter.java:449) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConv erter.doUnmarshal(AbstractReflectionConverter.java:290) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConv erter.unmarshal(AbstractReflectionConverter.java:230) at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshall er.java:72) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(A bstractReferenceUnmarshaller.java:65) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnm arshaller.java:66) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnm arshaller.java:50) at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller .java:134) at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarsh al(AbstractTreeMarshallingStrategy.java:32) at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1035)** ** at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1019)** ** at com.thoughtworks.xstream.XStream.fromXML(XStream.java:895) at com.thoughtworks.xstream.XStream.fromXML(XStream.java:886) at org.drools.ide.common.server.util.BRXMLPersistence.unmarshal(BRXMLPer sistence.java:191) at org.drools.guvnor.server.contenthandler.drools.BRLContentHandler.retr ieveAssetContent(BRLContentHandler.java:41) at org.drools.guvnor.server.RepositoryAssetService.handlePackageItem(Rep ositoryAssetService.java:132) at org.drools.guvnor.server.RepositoryAssetService.loadRuleAsset(Reposit oryAssetService.java:118) at org.drools.guvnor.server.RepositoryAssetService$Proxy$_$$_WeldClientP roxy.loadRuleAsset(RepositoryAssetService$Proxy$_$$_WeldClientProxy.java)* *** at org.drools.guvnor.server.RepositoryServiceServlet.loadRuleAsset(Repos itoryServiceServlet.java:403) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:5 69) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(Remot eServiceServlet.java:208) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(Remot eServiceServlet.java:248) at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(Ab stractRemoteServiceServlet.java:62) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)*** * at
[rules-users] command line to import repository
we have many environments and require the ability to refresh these environments weekly. this would be much easier to perform via a script/cron then requiring to perform via manually. Has any thought been put into creating such or does the ability exist but is just undocumented? I read a post back on Dec 1, 2009 requesting such ability and as of then, there was not a way of performing this. I cannot imagine there has not been any thought or development to perform such a menial task via command line to enable scripted processes. If the ability exist via GUI then there has to be some command(s) that exist to perform an import via command line. At least the logic exists, so the command should not be to difficult to develop. respectfully, jme -- View this message in context: http://drools.46999.n3.nabble.com/command-line-to-import-repository-tp4017702.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] Looking for Drools audit tool
This https://community.jboss.org/wiki/DroolsVerifier and Google are probably your best bets. On 31 May 2012 13:22, paco fifi_nji...@yahoo.fr wrote: Thank yyou very much. But can you tell me where can I find documentation and examples about Drools verifier? Thanks Paco -- View this message in context: http://drools.46999.n3.nabble.com/Looking-for-Drools-audit-tool-tp4017686p4017698.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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Guvnor test case with fact with Object fields
Hello, I have a fact that has is also my entity model and it has a field that is a class called state which holds previous and current state values (enum). So i have a condition that gets the state and gets the two values to check. The issue i'm running into is with creating a test case in guvnor, is it possible to create a test case with a field that is an object like this? Guvnor recognizes that i have a field called state but it doesn't realize that it is a class so it doesn't look like i would be able to test any rules the uses state as a condition check. Thanks -- View this message in context: http://drools.46999.n3.nabble.com/Guvnor-test-case-with-fact-with-Object-fields-tp4017705.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] drools.packagebuilder.conf
Hi all, i have developed some custom evaluators, and all worked fine with drools 5.3. I put the file in object under my home folder. I would like to pass to 5.4 final, but it doesn't read that file. Where does it find the file? Thanks a lot, Matteo. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] drools.packagebuilder.conf
In my Maven project, I put it in src/main/resources/META-INF of the module from which I start Drools. Chris From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Matteo Cusmai Sent: Thursday, May 31, 2012 11:51 AM To: Rules Users List Subject: [rules-users] drools.packagebuilder.conf Hi all, i have developed some custom evaluators, and all worked fine with drools 5.3. I put the file in object under my home folder. I would like to pass to 5.4 final, but it doesn't read that file. Where does it find the file? Thanks a lot, Matteo. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] drools.packagebuilder.conf
Hi Chris, thanks a lot, but i am not using maven. I use ant to compile my project and i need that file at runtime. Bye, Matteo. On Thu, May 31, 2012 at 10:38 PM, Christopher Dolan christopher.do...@avid.com wrote: In my Maven project, I put it in src/main/resources/META-INF of the module from which I start Drools. Chris ** ** *From:* rules-users-boun...@lists.jboss.org [mailto: rules-users-boun...@lists.jboss.org] *On Behalf Of *Matteo Cusmai *Sent:* Thursday, May 31, 2012 11:51 AM *To:* Rules Users List *Subject:* [rules-users] drools.packagebuilder.conf ** ** Hi all, i have developed some custom evaluators, and all worked fine with drools 5.3. I put the file in object under my home folder. I would like to pass to 5.4 final, but it doesn't read that file. Where does it find the file? Thanks a lot, Matteo. ___ 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] Drools 5.4.0.FINAL and OSGI. Unable to instantiate service for Class 'org.drools.concurrent.ExecutorProvider'
Looks like you have some classpath issues and using the incorrect jar versions. On 29/05/2012 14:30, Per Sterner wrote: [ERROR] [System] - Caused by: java.lang.ClassNotFoundException: org.drools.concurrent.ExecutorProviderImpl ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Papers about Drools Verifier
On 28/05/2012 22:21, Jackson Cunha wrote: Anyone knows about academic papers involving drools verifier? I'm working in a project where will be produced a paper and I need to cite some caracteristics of it. A good starting point is on the ez-expert page, which covers various papers on the topic. http://www.ez-xpert.com/whitepapers/verification.html Mark Thanks. Jackson Cunha Cassimiro (CereB) Bacharel em Ciencia da Computação - UFPI MSN: jackson.ce...@gmail.com mailto:jackson.ce...@gmail.com Telefone Móvel +55 86 9928 1251 Analista de Sistemas - Infoway - http://www.infoway-pi.com.br Missão Infoway - Influenciar a Gestão de Sistemas de Saúde através de e-health (A vida é um combate que os fracos abate, aos bravos, aos fortes só pode exaltar - Canção do Tamoio, Gonçalves Dias) ___ 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] command line to import repository
On 2012/5/31 22:16, halljme wrote: we have many environments and require the ability to refresh these environments weekly. this would be much easier to perform via a script/cron then requiring to perform via manually. Has any thought been put into creating such or does the ability exist but is just undocumented? I read a post back on Dec 1, 2009 requesting such ability and as of then, there was not a way of performing this. I cannot imagine there has not been any thought or development to perform such a menial task via command line to enable scripted processes. If the ability exist via GUI then there has to be some command(s) that exist to perform an import via command line. At least the logic exists, so the command should not be to difficult to develop. respectfully, jme -- View this message in context: http://drools.46999.n3.nabble.com/command-line-to-import-repository-tp4017702.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 Hi, you can do this through Guvnor REST interface. Check this doc out: https://community.jboss.org/wiki/PublishDroolsartifactsfromaproductionenvironment?_sscc=t Cheers, Jervis ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Papers about Drools Verifier
Thanks Mark! When my paper and my prototype is running I will show all results here to get feedback. On 31 May 2012 23:04, Mark Proctor mproc...@codehaus.org wrote: On 28/05/2012 22:21, Jackson Cunha wrote: Anyone knows about academic papers involving drools verifier? I'm working in a project where will be produced a paper and I need to cite some caracteristics of it. A good starting point is on the ez-expert page, which covers various papers on the topic. http://www.ez-xpert.com/whitepapers/verification.html Mark Thanks. Jackson Cunha Cassimiro (CereB) Bacharel em Ciencia da Computação - UFPI MSN: jackson.ce...@gmail.com Telefone Móvel +55 86 9928 1251 Analista de Sistemas - Infoway - http://www.infoway-pi.com.br Missão Infoway - Influenciar a Gestão de Sistemas de Saúde através de e-health (A vida é um combate que os fracos abate, aos bravos, aos fortes só pode exaltar - Canção do Tamoio, Gonçalves Dias) ___ rules-users mailing listrules-users@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Jackson Cunha Cassimiro (CereB) Bacharel em Ciencia da Computação - UFPI MSN: jackson.ce...@gmail.com Telefone Móvel +55 86 9928 1251 Analista de Sistemas - Infoway - http://www.infoway-pi.com.br Missão Infoway - Influenciar a Gestão de Sistemas de Saúde através de e-health (A vida é um combate que os fracos abate, aos bravos, aos fortes só pode exaltar - Canção do Tamoio, Gonçalves Dias) ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users