[rules-users] Drools 5.2 performance building KnowledgeBase

darktyco darktyco at gmail.com
Tue Aug 9 13:38:11 EDT 2011


Has anyone out there experienced any slowdowns using Drools 5.2 to build a
knowledge base? I have around 700 drl files (containing anywhere from 1 to
30 rules each) and the time to build a KnowledgeBase with them has increased
from about 10 minutes in Drools 5.1 to 90 minutes in Drools 5.2. I realize I
have a slow computer here, but the time difference between the two versions
is staggering. 

I have already been serializing the KnowledgeBase object for performance
reasons and even loading the serialized KnowledgeBase takes about 3-4x
longer in 5.2 than in 5.1. Am I doing something wrong here? Here are some
code snippets of how I am building and loading the kbase: 

//////////////////////// Building 
final KnowledgeBuilder kBuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder(); 
final List<File> drlFiles = getAllDrlFiles(directory); 
for (final File name : drlFiles) { 
        kBuilder.add(ResourceFactory.newFileResource(name),
ResourceType.DRL); 
} 
if (kBuilder.hasErrors()) { 
        // .... 
} 
final KnowledgeBase kBase = KnowledgeBaseFactory.newKnowledgeBase(); 
kBase.addKnowledgePackages(kBuilder.getKnowledgePackages()); 
ObjectOutputStream oos = null; 
try { 
        oos = new DroolsObjectOutputStream(new FileOutputStream(pkgFile)); 
        oos.writeObject(kBase); 
} catch (...) { 
        // .... 
} 

//////////////////////// Loading 
ois = new DroolsObjectInputStream(new FileInputStream(pkgFile)); 
final KnowledgeBase kBase = (KnowledgeBase) ois.readObject(); 
final StatefulKnowledgeSession ksession =
kBase.newStatefulKnowledgeSession(); 

Thanks!

--
View this message in context: http://drools.46999.n3.nabble.com/Drools-5-2-performance-building-KnowledgeBase-tp3239746p3239746.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list