[rules-users] Max packages

Mark Proctor mproctor at codehaus.org
Thu Aug 14 13:01:22 EDT 2008


Joe White wrote:
>
> Mark, thank you very much for your help, it is greatly appreciated.
>
>  
>
> "There are improvements we can make to generated code into a single 
> class and use a switch statement to invoke the correct part, but we 
> don't have time for that right now, so would need to come from the 
> community."
>
>  
>
> I would be interested in doing this work if someone can point me in 
> the right direction on where to start.
>
look for the *.mvel templates in drools-compiler you'll see how we 
generate the code. Then look at all the various java builders, like 
JavaConsequenceBuilder and you'll see how we construct it. compiled code 
is done in two places. We first generate an invoker class which 
implements the interface, like the Consequence interface and then we 
genernate the code to be executed which is called via the invoker. It 
needs to be two as the needed parameters for the java consequence to 
execute differer (different number of vars) so the invokers job is to 
match the needed interfaces and adapt/bridge to calling to the actual 
consequence/eval/predicate. We currently generate all the 
consequence/eval/predicate in a single class per rule, but we have a 
class per invoker.

So we now need invoker apis, like Consequence, to take an int so it can 
use a switch statement to which allows multiple invocations to be 
generated into the same file. An idea solution will take a configuration 
on teh granularity that people want - to what we have now right up to 
putting everything into a single file for the entire package.
>
> I also would be interested in doing the work to allow drools to 
> reference multiple levels of inner classes.
>
This is done and fixed in 4.0.x and trunk - we just haven't released any 
binaries wit hteh fix.
>
> Our work would benefit from both pieces of functionality. I'll move 
> this to the developer list, but would appreciate if somebody 
> knowledgeable could show me where to get started on the code necessary 
> to generate to a single class.
>
I've cc'd this into the dev mailing list, so please when you reply do so 
to just that mailing list.
>
>  
>
> Thanks,
>
> Joe
>
>  
>
> *From:* rules-users-bounces at lists.jboss.org 
> [mailto:rules-users-bounces at lists.jboss.org] *On Behalf Of *Mark Proctor
> *Sent:* Wednesday, August 13, 2008 2:53 AM
> *To:* Rules Users List
> *Subject:* Re: [rules-users] Max packages
>
>  
>
> Joe White wrote:
>
> Can someone help me understand the relationship between the number of 
> Packages in a single RuleBase and PermGen memory consumption? I have a 
> test that generates  200 rules and then adds those rules as different 
> packages to a single rule base. PermGen consumption grows near 
> linearly with the addition of Packages to the rule base and on a 
> default PermGen setting the JVM runs out of PermGen after about 120 
> packages.
>
> It's not related to Packages, it's related to the number of rules and 
> whether those rules have compiled java parts  - like the consequence, 
> eval etc - each one adds an additional class.
>
>  
>
> Is every new Package and RuleBase backed by a set of generated 
> Classes? Is there a way to get around the amount of class generation 
> that is taking place?
>
> The test has been run against Drools 5.
>
> You can use MVEL, which has no class generation. There are 
> improvements we can make to generated code into a single class and use 
> a switch statement to invoke the correct part, but we don't have time 
> for that right now, so would need to come from the community.
>
>  
>
> Thank you for your help,
>
> Joe
>
>  
> ------------------------------------------------------------------------
>
>
>   
>  
> _______________________________________________
> 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
>   
>
>  
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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/20080814/a3c0f284/attachment.html 


More information about the rules-users mailing list