[
https://issues.jboss.org/browse/DROOLS-496?page=com.atlassian.jira.plugin...
]
Davide Sottara commented on DROOLS-496:
---------------------------------------
A rule that requires more than 64 patterns is usually suspicious.. unless it's a very
peculiar use case, there are normally ways to re-engineer the logic to simplify the rule,
as you did.
As for the performance comparison, there's no definitive answer to that question.. The
actual performance of the engine depends on the combination of rules and the facts, so any
average statistics may be quite different - for good or for bad - from your use case. On
the other hand, you can easily do a comparison - switching from one engine to the other
takes two lines of code.
Please also consider that the rete-oo mode is considered deprecated and may no longer be
supported in the future. However, we won't drop the rete-oo mode until this limitation
is addressed.
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: Blocker
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)