<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="Times New Roman, Times, serif">Hello.<br>
<br>
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.<br>
<br>
1) Parse rules in groups.<br>
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.<br>
<br>
2) Parsing takes a lot of memory.<br>
During parsing of group about 20000 rules my test application
takes about 500MB memory.<br>
<br>
3) Use only one package.<br>
Loading rules into one package is extremely faster than loading
every rule into separated package.<br>
<br>
4) Call KnowledgeBase.add() method only once.<br>
Prepared set of rules should be added by one call of
KnowledgeBase.add() method instead of adding each rule by
separated method call.<br>
<br>
5) Method Session.fireAllRules() works extremely fast.<br>
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).<br>
<br>
Regards,<br>
Piotr</font><br>
</body>
</html>