[rules-users] Reading DRL file with large number of rules

kpowerinfinity kpowerinfinity at gmail.com
Sat Feb 6 06:42:25 EST 2010


Hello,

We are trying to run a DRL file that has more than 20K rules, all of
which have the simple form:



rule "testpeoplenumber"
	salience 100
	dialect "mvel"
	when
		LineItem( inventoryItemCode == "8903210392090")
then
		InventoryItem fact0 = new InventoryItem();
		fact0.setCategoryCode( "ONPROMO" );
		insert(fact0 );
end

However, the rule file is not getting parsed by the builder, and
either takes a very long time (well over half an hour), or gives a
Heap Overflow exception. We tried with a smaller file (about 1K rules,
and the situation is the same).

The parsing code is:
org.drools.KnowledgeBaseConfiguration kbc =
org.drools.KnowledgeBaseFactory.newKnowledgeBaseConfiguration(null,
cl);
            org.drools.KnowledgeBase kbase =
org.drools.KnowledgeBaseFactory.newKnowledgeBase(kbc);
                org.drools.builder.KnowledgeBuilderConfiguration
knowledgeBuilderConfig =
org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(null,
cl);
            org.drools.builder.KnowledgeBuilder builder =
org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(kbase,
knowledgeBuilderConfig);
            org.drools.builder.impl.KnowledgeBuilderImpl builderImpl =
builder as org.drools.builder.impl.KnowledgeBuilderImpl;

            builder.add(org.drools.io.ResourceFactory.newFileResource(filename),
                    org.drools.builder.ResourceType.DRL);

We are using Drools v5. We've tried both with the java jar as well as
in .NET (using IKVM to compile it).

Any help in understanding why this is happening and how it can be
avoided will be appreciated.

Warm Regards
Krishna.

--
http://kpowerinfinity.wordpress.com
http://www.linkedin.com/in/kpowerinfinity



More information about the rules-users mailing list