Title: Poor performance by loading large data

Hi all,

I am using Rete engine to load up large amount of facts in the working area. (lets say 50.000 facts of type A and 500.000 facts of type B)

The problem is that: if I load FIRST facts A, these are loaded fast, but AFTER that, facts B are loaded very slowly.

And the other way around, if I start with B, the 500.000 objects are loaded fast and after the remaining 50.000 of A very slow.

I have tried more than one way to load up: 1) new Fact / rete.assertFact()

                      2) new ObjectA  / rete.definstance(ObjectA, objectA, false)

                      3) new ObjectA  / rete.store(ObjectA, objectA) / rete.executeCommand("(definstance ObjectA (fetch    ObjectA) static)");

Below is a code snippet with variant 1) (but as said, Ive tried all three). Objects/facts I use are not complex, they have only a few fields.

Maybe someone has met the problem already, and I do smth wrong, or maybe I reach the limits of Rete engine?

...

// instead of ObjectA it is written Request

 private static void loadRequests() throws JessException {

        long beginTime = System.currentTimeMillis();

        Fact f = null;

        System.out.println("Start loading requests ...");

        for (int requestId = 1; requestId <=50000; requestId++ ) {

            f = new Fact("Request", rete);

            f.setSlotValue("addressType", new Value(0, RU.INTEGER));

            f.setSlotValue("requestType", new Value(0, RU.INTEGER));

            f.setSlotValue("requestID", new Value(requestId, RU.INTEGER));

            rete.assertFact(f);

        }

}

...

// instead of ObjectsB it is written Hits

private static void loadHits() throws JessException {

        Fact f = null;

        long beginTime = System.currentTimeMillis();

        System.out.println("Start loading hits ...");

        for (int requestId=1; requestId <= 50000; requestId++) {

            for (int i = 1; i<=10; i++) {

                f = new Fact("CustomerHit", rete);

                f.setSlotValue("hitID", new Value(i+requestId, RU.INTEGER));

                f.setSlotValue("customerID", new Value(0, RU.INTEGER));

                f.setSlotValue("requestID", new Value(requestId, RU.INTEGER));

                f.setSlotValue("companyID", new Value(i, RU.INTEGER));

                rete.assertFact(f);

            }

        }

        System.out.println("Time for loading " + (REQUEST_NO * 10) + " hits : " + (System.currentTimeMillis() - beginTime));

}

...

Thanks in advance for your answer,

Cristian Negoita

 

Reply via email to