Thank you for your responses, at the very least I know we're not building/running incorrectly now. Running the rules seems as fast as ever, here are some simple timings of my test runner getting the KieServices, the KieContainer, and then repeatedly getting new sessions and firing the rules:
09:30:18,482 INFO Drools6Test:34 - Start
09:30:18,490 INFO Drools6Test:36 - Obtained KieServices
09:30:18,503 INFO ClasspathKieProject:115 - Found kmodule: file:/development/work/drools6test/target/classes/META-INF/kmodule.xml
09:30:18,504 DEBUG ClasspathKieProject:370 - KieModule URL type=file url=/development/work/drools6test/target/classes
09:30:18,661 WARN ClasspathKieProject:259 - Unable to find pom.properties in /development/work/drools6test/target/classes
09:30:18,667 INFO ClasspathKieProject:301 - Recursed up folders, found and used pom.xml /development/work/drools6test/pom.xml
09:30:18,668 DEBUG ClasspathKieProject:102 - Discovered classpath module com.test.rules:drools6test:0.0.1-SNAPSHOT
09:30:18,670 INFO KieRepositoryImpl:73 - KieModule was added:FileKieModule[ ReleaseId=com.test.rules:drools6test:0.0.1-SNAPSHOTfile=/development/work/drools6test/target/classes]
09:30:18,670 INFO ClasspathKieProject:115 - Found kmodule: jar:file:/home/kmeadows/.m2/repository/com/test/rules/drools6build/0.0.1-SNAPSHOT/drools6build-0.0.1-SNAPSHOT.jar!/META-INF/kmodule.xml
09:30:18,671 DEBUG ClasspathKieProject:370 - KieModule URL type=jar url=/home/kmeadows/.m2/repository/com/test/rules/drools6build/0.0.1-SNAPSHOT/drools6build-0.0.1-SNAPSHOT.jar
09:30:18,678 DEBUG ClasspathKieProject:240 - Found and used pom.properties META-INF/maven/com.test.rules/drools6build/pom.properties
09:31:37,669 DEBUG ClasspathKieProject:102 - Discovered classpath module com.test.rules:drools6build:0.0.1-SNAPSHOT
09:31:37,669 INFO KieRepositoryImpl:73 - KieModule was added:ZipKieModule[ ReleaseId=com.test.rules:drools6build:0.0.1-SNAPSHOTfile=/home/kmeadows/.m2/repository/com/test/rules/drools6build/0.0.1-SNAPSHOT/drools6build-0.0.1-SNAPSHOT.jar]
09:31:37,670 INFO Drools6Test:38 - Obtained KieContainer
09:31:37,670 INFO Drools6Test:58 - Starting session
09:33:33,576 DEBUG KnowledgeBaseImpl:186 - Starting Engine in PHREAK mode
09:33:57,052 INFO Drools6Test:72 - Closing session
09:33:57,052 INFO Drools6Test:58 - Starting session
09:33:57,175 INFO Drools6Test:72 - Closing session
09:33:57,175 INFO Drools6Test:58 - Starting session
09:33:57,280 INFO Drools6Test:72 - Closing session
09:33:57,280 INFO Drools6Test:58 - Starting session
09:33:57,381 INFO Drools6Test:72 - Closing session
09:33:57,381 INFO Drools6Test:58 - Starting session
09:33:57,444 INFO Drools6Test:72 - Closing session
09:33:57,444 INFO Drools6Test:58 - Starting session
09:33:57,517 INFO Drools6Test:72 - Closing session
09:33:57,517 INFO Drools6Test:58 - Starting session
09:33:57,575 INFO Drools6Test:72 - Closing session
So getting the KieContainer takes ~1 min 20 seconds, then getting the first session/executing takes ~2 min 20 seconds. Creating each subsequent session/execute takes less than one second each.
That said I'd still really love to get the memory consumption of the rule compilation down because it is problematic for the app server. I have been running with -Xmx4000m -XX:MaxPermSize=1024m as my memory settings to get around both heap and perm gen errors. I don't know what is considered "good" memory consumption in Drools but it seems high to me. I have had a suspicion for a while now that maybe our domain model has been constructed in a way that is un-optimal for the Drools and/or MVEL data structures. All of our rules reference the same root object like this:
Almost every single rule references this Participant object. In the 5.x code this resulted in a Rete tree with a very, very wide horizontal level below the root node. Does this look to you guys like it could be the cause of the high memory consumption? Unfortunately Mario I do not have permission to share the rules. When I let jProfiler profile my Drools6Test.java for a while it looks like most of CPU time is being spent here:
By far the biggest chunks of memory are being taken up by char[] data and java.util.HashMap$Entry data. The biggest memory allocation hotspot is:
In my experience with profiling the data can be deceptive sometimes so I may not be looking at the right stuff. Also this is only from letting it run for 1.5 hours so I may not have even let it run long enough to get an accurate picture. Let me know if this tells you anything or if there is some additional information I can provide.