Hello.
Some time ago I wrote an e-mail with question how to parse and
load a large group of rules in an efficient way. I've made a lot
of tests and I have couple conclusions. Is there a possibility
that someone could confirm (if I'm right) or deny (if I'm wrong)
my conclusions, and explain why Drools behave in such a way.
1) Parse rules in groups.
Parsing of rules should be done in large groups. Send to
knowledgeBuilder.add() method e.g. 100 rules at one time, instead
of parsing one by one rule.
2) Parsing takes a lot of memory.
During parsing of group about 20000 rules my test application
takes about 500MB memory.
3) Use only one package.
Loading rules into one package is extremely faster than loading
every rule into separated package.
4) Call KnowledgeBase.add() method only once.
Prepared set of rules should be added by one call of
KnowledgeBase.add() method instead of adding each rule by
separated method call.
5) Method Session.fireAllRules() works extremely fast.
Despite fact that I load thousands of rules into KnowledgeBase,
inserting a new fact and call Session.fireAllRules() works very
efficient (it takes below 1ms).
Regards,
Piotr