[rules-users] Speed up inserting of rules into knowledge base

Drooliver oliver.hagel at daimler.com
Tue Apr 5 05:32:15 EDT 2011


I have a very similar issue - so I'm interested in any further performance
tips or findings:

We use Drools with an interface where users can update / edit rules. Those
rules are then stored (and versioned) in a database. Afterwards the rules
are fetched again from database and added one by one in the following way:

 
for (Rule rule ...) {
knowledgeBuilder.add(ResourceFactory.newByteArrayResource(rule.getRuleContent().getBytes()),
ResourceType.DRL);

 if (kbuilder.hasErrors()) { throw Error... }
}

 kbase = KnowledgeBaseFactory.newKnowledgeBase();
 kbase.addKnowledgePackages(knowledgeBuilder.getKnowledgePackages());



We have several hundred rules and a rule checking throughput of also several
hundred rules/second (on 2 nodes). With the number of rules increasing this
KnowledgeBase update takes longer and longer (compiling all those rules) and
during this time no rule can be checked. So the system stands still from the
user point of view.

There seems to exist no possibility to refresh a rule selectively - is this
correct? If yes, then how is the best way to handle such a situation? The
first idea that comes to mind is using two KnowledgeBases in parallel...

--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Speed-up-inserting-of-rules-into-knowledge-base-tp2211394p2779221.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list