[rules-users] Speeding up Drools

Phani Saripalli saripalli.phani at gmail.com
Thu Oct 4 05:46:17 EDT 2012


HI.

I am using declared types in my .drl file. I have a declared type with 1000
fields (using the Drools 5.5. beta, so 1000 fields is allowed). I have 100
rules. However, creating the stateful knowledge base is very slow. It is
taking nearly 8 seconds. Can somebody tell me, suggest how can I speed up
the process?

Briefly, this is how I measured.

long loadI = System.currentTimeMillis();
            // load up the knowledge base
            KnowledgeBase kbase = readKnowledgeBase();
            StatefulKnowledgeSession ksession =
kbase.newStatefulKnowledgeSession();
            
            ksession.setGlobal("cList", new ArrayList<Integer>());
            FactType fact = kbase.getFactType("com.sample", "Project");
            Object projIns = fact.newInstance();
            ksession.insert(projIns);
            long loadO = System.currentTimeMillis();
            System.out.println("time to load facts : " + ((loadO / 1000.0) -
(loadI / 1000.0)));
            
            ksession.getAgenda().getAgendaGroup("Group Config").setFocus();
            ksession.fireAllRules();
            ksession.getAgenda().getAgendaGroup("Fact Config").setFocus();
            ksession.fireAllRules();
            ksession.getAgenda().getAgendaGroup("Group 0").setFocus();
            ksession.fireAllRules();
            ksession.getAgenda().getAgendaGroup("Group 1").setFocus();
            ksession.fireAllRules();
            ksession.getAgenda().getAgendaGroup("Group 2").setFocus();
            ksession.fireAllRules();


Many thanks
Phani



--
View this message in context: http://drools.46999.n3.nabble.com/Speeding-up-Drools-tp4020132.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list