[jboss-jira] [JBoss JIRA] (DROOLS-496) Rules in Drools 6.x cannot use more than 64 patterns
Mark Proctor (JIRA)
issues at jboss.org
Wed Aug 6 22:20:29 EDT 2014
[ https://issues.jboss.org/browse/DROOLS-496?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12991104#comment-12991104 ]
Mark Proctor commented on DROOLS-496:
-------------------------------------
We use bit masks to optimise the network. There can be a maximum of 64 joins for a segment, and a maximum of 64 segments. This isn't likely to change:
http://blog.athico.com/2013/11/rip-rete-time-to-get-phreaky.html
For now you can use the reteoo mode, which falls back to the old rete engine while still using 6.0.
Longer term we could allow pluggable bit mask system, that uses a long or a OpenBitSet (if needed):
https://github.com/droolsjbpm/drools/blob/beliefs/drools-beliefs/src/main/java/org/drools/beliefs/bayes/OpenBitSet.java
But there is no schedule for this right now.
> Rules in Drools 6.x cannot use more than 64 patterns
> ----------------------------------------------------
>
> Key: DROOLS-496
> URL: https://issues.jboss.org/browse/DROOLS-496
> Project: Drools
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Affects Versions: 6.0.0.Final, 6.0.1.Final, 6.1.0.Final, 6.2.0.Beta1
> Reporter: Jörgen Risholt
> Assignee: Mark Proctor
> Priority: Critical
> Attachments: drools-test_5.6.0.tar, drools-test_6.0.1.tar
>
>
> When trying a script as shown below we can not get it to work with 6.0.1 but with 5.6.0. There seems to be some relation to the number of facts, the more facts the higher probablity that the 6.0.1 version do not trigger. We have made two simple singelthreaded scenarios that I can upload if wanted.
> The examle has a lot of facts, but we notice that from about 50 it seems that the problam may occur.
> rule "TestRule"
> Person(name == "Name0")
> Person(name == "Name1")
> ....
> Person(name == "Name1000")
> then
> System.out.println("Successfully trigged");
> end
> This is the testcode for 5.6.0.Final (work always):
> package drools_test;
> import org.drools.KnowledgeBase;
> import org.drools.builder.KnowledgeBuilder;
> import org.drools.builder.KnowledgeBuilderFactory;
> import org.drools.builder.ResourceType;
> import org.drools.io.ResourceFactory;
> import org.drools.runtime.StatefulKnowledgeSession;
> import drools_test.data.Person;
> public class App {
> private final static int NUMBER_OF_PERSONS = 3000;
> public static void main(String[] args) {
> KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
> kbuilder.add(ResourceFactory.newClassPathResource("rules.drl",
> App.class), ResourceType.DRL);
> KnowledgeBase kb = kbuilder.newKnowledgeBase();
> StatefulKnowledgeSession session = null;
> try {
> session = kb.newStatefulKnowledgeSession();
> for (int i = 0; i < NUMBER_OF_PERSONS; ++i) {
> session.insert(new Person(String.format("Name%s", i)));
> session.fireAllRules();
> }
> session.fireAllRules();
> } finally {
> if (session != null) {
> session.dispose();
> }
> }
> }
> }
> And this is the same code for 6.0.1.Final which always fails:
> package drools_test;
> import org.kie.api.KieServices;
> import org.kie.api.runtime.KieContainer;
> import org.kie.api.runtime.KieSession;
> import drools_test.data.Person;
> public class App
> {
> private final static int NUMBER_OF_PERSONS = 3000;
> public static void main(String[] args)
> {
> KieServices kieServices = KieServices.Factory.get();
> KieContainer kContainer = kieServices.getKieClasspathContainer();
> KieSession session = null;
> try {
> session = kContainer.newKieSession();
> for (int i = 0; i < NUMBER_OF_PERSONS; ++i) {
> session.insert(new Person(String.format("Name%s", i)));
> session.fireAllRules(); // Comment out this line and the rule will fire.
> }
> session.fireAllRules();
> } finally {
> if (session != null) {
> session.dispose();
> }
> }
> }
> }
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
More information about the jboss-jira
mailing list