Hi,
I noticed something interesting. The issue with memory is happening always
while inserting the second set of objects into working memory!
Earlier, I was insering the DriverVO's into WM and then inserting the
AssignmentsVO, and the system was hanging while inserting the
AssignmentsVO. Then I reversed the order of insertion and then the machine
was hit while inserting the DriverVO's.
Does anyone know why this issue might be happening and how to overcome this?
Thanks in advance,
Jayadevan.
On Jun 1, 2009 6:51pm, jayadevan.m(a)gmail.com wrote:
Thanks W,
I tried it out ,But didn't get any performance improvement :(
The issue might be that I am inserting too many objects into working
memory
jayadevan
On Jun 1, 2009 3:36pm, Wolfgang Laun wolfgang.laun(a)gmail.com>
wrote:
> The first two patterns pair each driver assignment with each
trip -
>
>
> which is quite a lot of work to do. (The infix "and"
between the 2nd
>
>
> and 3rd pattern doesn't change this.) Also, the field
restriction
>
>
> "tripId in ($tid)" is not the most efficient way.
>
>
>
>
>
> Try this:
>
>
>
>
>
> rule "Assignment Check"
>
>
> when
>
>
> $creVo: DriverAssignVO($drId: driverId, $tid1: tripId)
>
>
> $creVo: DriverAssignVO(driverId == $drId, $tid2: tripId !=
$tid1)
>
>
> $trAsgn1: TripVO( tripId == $tid1, $startDtmUtc: startDtmUtc,
>
>
> $endDtmUtc: endDtmUtc)
>
>
> $trAsgn2: TripVO( tripId == $tid2,
>
>
> ((startDtmUtc >= $startDtmUtc && startDtmUtc
>
> (endDtmUtc >= $startDtmUtc && endDtmUtc
>
> then
>
>
> System.out.println("TRIP ID: " + $crvo.getTripId());
>
>
> end
>
>
>
>
>
> Here the first two patterns produce all pairs of assignments of
a
>
>
> single driver, and the remainder checks for overlaps.
>
>
>
>
>
> You'll also find that this produces two symmetric firings
for each
>
>
> overlap. It might be possible to avoid this by using
"$tid2: tripId >
>
>
> $tid1" in the second pattern, the id's data type
permitting.
>
>
>
>
>
> -W
>
>
>
>
>
>
>
>
> 2009/6/1 Mark Proctor mproctor(a)redhat.com>:
>
>
> > Please send these emails to the user list (in cc) so
everyone can
help, not
>
>
> > directly to me.
>
>
>
>
>
>
> > Mark
>
>
> > jayadevan m wrote:
>
>
>
>
>
>
> > Hi
>
>
>
>
>
>
> > We have one performance(memory) issue in drools-5
>
>
>
>
>
>
> > Our Scenario
>
>
>
>
>
>
> > We have 3 entities
>
>
>
>
>
>
> > Trip - Entity representing details about trip
>
>
>
>
>
>
> > Driver - Entity for driver , it contain details about
driver
>
>
>
>
>
>
> > Assignments - details about each assignments (one driver
may assigned
to
>
>
> > many trip)
>
>
>
>
>
>
> > The rule is to find ,"Find overlapping between trip
assignments"
>
>
>
>
>
>
> > For Implementing this we take the Trip ,Driver And
Assignments
entities
>
>
> > from Data base and put it into working memory
>
>
>
>
>
>
> > For Small number of records this rule work well ,
>
>
>
>
>
>
> > But we want to check it against 15000 driver ,331176
assignments and
12745
>
>
> > trips
>
>
>
>
>
>
> > In that case it take huge amount of time for execution
(rule firing )
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> > Rule is
>
>
>
>
>
>
>
> rule "Assignment Check"
>
>
>
>
>
>
>
> when
>
>
>
>
>
>
> > $creVo: DriverAssignVO($drId: driverId ,$tid: tripId);
>
>
>
>
>
>
> > $tripAssignment: TripVO(
>
>
>
>
>
>
> > $tpid: tripId,
>
>
>
>
>
>
> > $startDtmUtc: startDtmUtc,
>
>
>
>
>
>
>
> $endDtmUtc: endDtmUtc)
>
>
>
>
>
>
> > and
>
>
>
>
>
>
> > $trvo: TripVO(
>
>
>
>
>
>
> > tripId != $tpid,
>
>
>
>
>
>
> > tripId in ($tid),
>
>
>
>
>
>
>
> ((startDtmUtc >= $startDtmUtc && startDtmUtc
>
> > $endDtmUtc) ||
>
>
>
>
>
>
>
> (endDtmUtc >= $startDtmUtc && endDtmUtc
>
> > $endDtmUtc)));
>
>
>
>
>
>
> > $crvo: DriverAssignVO($drvrId: driverId , driverId == $drId
,
>
>
> > tripId != $tid, tripId == $tpid)
>
>
>
>
>
>
>
> then
>
>
>
>
>
>
>
> System.out.println("TRIP ID: " + $crvo.getTripId());
>
>
>
>
>
>
>
> end
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> > thanks and regards
>
>
>
>
>
>
> > _______________________________________________
>
>
> > rules-users mailing list
>
>
> > rules-users(a)lists.jboss.org
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
>
>
> rules-users mailing list
>
>
> rules-users(a)lists.jboss.org
>
>
>
>
>