Firstly look at basic java memory tuning – have you got enough memory, how often is your garbage collector running etc. There are plenty of tutorials online
dealing with generic Java garbage collector optimization.
In terms of drools performance a lot of it depends on the structure of your rules.
Firstly make sure you minimize Cartesian products (rules that match n of Object A all of which can then match against m of Object B etc) as with large numbers
of objects these can quickly create very large numbers of potentially activations.
You can minimize this by putting the most restrictive conditions first so that you reduce the combinations as quickly as possible.
If multiple rules have conditions in common try to put these first and in the same order, drools is then able to share these conditions rather than evaluating
them multiple times.
Try to avoid unnecessary “evals” as these are expensive to calculate.
Try to avoid “froms” as any updates to the subject of them require the entire statement to be re-evaluated
Try to put simple cheaper to run conditions first before the more computationally expensive conditions
Sometime introducing additional facts can greatly simplify your rules or reduce duplication of computation and so increase performance
Sometimes changing the structure of your model can have great impact.
Sometimes changing the design of how your rules work can create great simplifications.
Sometimes an eval into java code is much more efficient and cleaner than a big bunch of rules.
Of course a lot of the above can be contradictory – you have to experiment as to what performs best. But remember increasing performance can often also increase
complexity and maintenance costs and make bugs harder to spot so only do as much as you need.
Thomas
From: rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org]
On Behalf Of saurabh maheshwari
Sent: 02 February 2011 09:36
To: rules-users@lists.jboss.org
Subject: [rules-users] drools problem
Hi ,
I am not sure about drools perfomance does it depends on no of rules or at no of objects .
When i am having 30000+ objects in the memory , i am facing the perfomance issues .
Can any one tell how i can increase the perfomance of my rule Engine in case where i 'll have to have large number of objects in memory .
Please inform if you have any idea about this.
Thanks & Regards
Saurabh