4

I'm running Drools 7.10.0-FINAL Fusion on a linux(openembedded) box (single core 600MHz, 512MB RAM, Java SE Embedded 1.8) and looking for the ways I can improve Drools startup time. It's around ~32s now, would be good to halve it.

I have a single .drl file with two simple rules in a kjar module I'm building with kie-maven-plugin as mvn clean install -DgenerateModel=YES -e

Starting session as

1 KieServices ks = KieServices.Factory.get();
2 //this is slower KieContainer kContainer = ks.getKieClasspathContainer();
3 ReleaseId releaseId = ks.newReleaseId("...", "KnowledgeBase", "1.0");
4 KieContainer kContainer = ks.newKieContainer(releaseId);
5 this.kieSession1 = kContainer.newKieSession();

The times I'm getting

1  06:11:06,141 INFO  (ServiceDiscoveryImpl.java:107)  Loading kie.conf from  jar:!/META-INF/kie.conf in classloader sun.misc.Launcher$AppClassLoader@387f44
2  06:11:06,591 INFO  (ServiceDiscoveryImpl.java:141)  Adding Service org.drools.compiler.kie.builder.impl.KieServicesImpl
3  06:11:06,890 INFO  (ServiceDiscoveryImpl.java:141)  Adding Service org.drools.compiler.builder.impl.KnowledgeBuilderFactoryServiceImpl
4  06:11:06,969 INFO  (ServiceDiscoveryImpl.java:141)  Adding Service org.drools.core.io.impl.ResourceFactoryServiceImpl
5  06:11:07,065 INFO  (ServiceDiscoveryImpl.java:141)  Adding Service org.drools.core.marshalling.impl.MarshallerProviderImpl
6  06:11:07,120 INFO  (ServiceDiscoveryImpl.java:141)  Adding Service org.drools.core.concurrent.ExecutorProviderImpl   
7  06:11:07,140 INFO  (ServiceDiscoveryImpl.java:107)  Loading kie.conf from  jar:drools-model-compiler-7.10.0.Final.jar!/META-INF/kie.conf in classloader sun.misc.Launcher$AppClassLoader@387f44
8  06:11:07,280 INFO  (ServiceDiscoveryImpl.java:141)  Adding Service org.drools.modelcompiler.CanonicalKieModuleProvider
9  06:11:07,452 DEBUG (KieRepositoryImpl.java:89)      Cannot load a KieRepositoryScanner, using the DummyKieScanner
10 06:11:07,489 DEBUG (KieRepositoryImpl.java:130)     KieModule Lookup. ReleaseId KnowledgeBase:1.0 was not in cache, checking classpath
11 06:11:07,522 INFO  (KieRepositoryImpl.java:184)     Adding KieModule from classpath: file:KnowledgeBase-1.0.jar
12 06:11:07,788 DEBUG (ClasspathKieProject.java:397)   KieModule URL type=jar url=KnowledgeBase-1.0.jar
13 06:11:20,511 DEBUG (ClasspathKieProject.java:265)   Found and used pom.properties META-INF/maven/.../KnowledgeBase/pom.properties    
14 06:11:38,421 INFO  (RuleEngineModule.java:95)       KieSession started

most of the time (log entries 7-13) is spent in KieContainer kContainer = ks.newKieContainer(releaseId);

Any known techniques or educated guesses how to speed-up kie container instantiation?

d_z
  • 688
  • 3
  • 11
  • Do you actually have rules in a Maven artifact? I think that creating a KieContainer that way tries to actually resolve the Maven artifact that maps to that releaseId. – Roddy of the Frozen Peas Feb 25 '20 at 19:30

0 Answers0