[rules-users] inserting collection of facts

techy techluver007 at gmail.com
Fri Nov 7 18:46:58 EST 2008


Thanks a lot Greg.
Can you please advise which of two is best approach?

1. Having multiple rulebase and assign to child thread. each child thread
would a single stateful session and fire rule for given facts.
2. having one rulebase and create multiple stateful session and assign to
each child thread.

3. I would give batch of facts to child threads. once they complete the
firing rules. now I want to release these facts from memory before I process
next batch of facts using same or new child threads.  Do I need to do any
explicit clean up in either rulebase or stateful session ? or would JVM GC
take care of the clean up as long as I don't maintain any ref to those facts
in my application?



Greg Barton wrote:
> 
> --- On Fri, 11/7/08, techy <techluver007 at gmail.com> wrote:
> 
>> 1. I can't have multiple session from same rulebase and
>> assign each session to single thread. right?
> 
> No reason why you couldn't.  The Session is what holds the state.  Now
> there may be differences between StatefulSession and StatelessSession. 
> StatelessSession you can definately do this.  The originating RuleBase
> maintains no reference to the StatelessSessions spawned from it.  A
> RuleBase does maintain references to the StatefulSessions it spawns, so
> you should be aware of that.  I'd say if you create the StatefulSessions
> in a single thread, then execute them in their own child threads, you
> should be fine.
> 
>> 2. Can I use drools 5 in production environment? if not, 
>> when is first prod release expected?
> 
> That's a question for the dev team. :)
> 
>> 3. where can I do look for rule base partitioning
>> examples/info?
> 
> I looked last night through the docs in trunk and couldn't find any, but
> all I did was "grep -i partitioning".  Probably the best place to look is
> in the unit tests.  There's only one method you need to call to set it up,
> setMultiThreadedEvaluation(boolean).  And see this unit test in trunk for
> an example:
> 
> drools-compiler\src\test\java\org\drools\integrationtests\RulebasePartitioningTest.java
> 
>> 
>> 
>> Greg Barton wrote:
>> > 
>> > I'm assuming you'll be running each rule base
>> in a separate thread
>> > simultaneously?  There are no dependencies between the
>> rules in the five
>> > rule bases?  If so, that will work just fine.  
>> > 
>> > If your rules are simple enough you can use sequential
>> mode.  It can speed
>> > up execution quite a bit. 
>> > 
>> >
>> http://downloads.jboss.com/drools/docs/4.0.7.19894.GA/html_single/index.html#d0e1295
>> > 
>> > This could be used in conjunction with the
>> simultaneous execution above.
>> > 
>> > Finally, you can get some multithreaded benefit in a
>> single rule session
>> > if you're using drools 5 and turn on rule base
>> partitioning.  As I
>> > understand it this works best when the rules have less
>> join conditions in
>> > them. (i.e. mostly single object conditions, and less
>> multi-object
>> > conditions.)
>> > 
>> > --- On Thu, 11/6/08, techy
>> <techluver007 at gmail.com> wrote:
>> > 
>> >> From: techy <techluver007 at gmail.com>
>> >> Subject: [rules-users] Rule processing for High
>> volume input
>> >> To: rules-users at lists.jboss.org
>> >> Date: Thursday, November 6, 2008, 3:41 PM
>> >> I have to run rules(1000 rules) against 20-30
>> million of
>> >> record each day.
>> >> I guess I would have memory issue If I insert all
>> of
>> >> records into working
>> >> memory.
>> >> 
>> >> so I'm thinking to have multiple rule base
>> instance and
>> >> do batch processing
>> >> as given below.so that I can avoid memory issue
>> and quick
>> >> rule processing
>> >> 
>> >> 
>> >> a.Take  first 1 million records and distribute 1
>> millon
>> >> across working
>> >> memory of 5 rule base.
>> >> b.fire rules in all 5 rule base
>> >> c.clear working memory of all rule base
>> >> d. take next 1 million record and start from
>> step-a till I
>> >> process all of
>> >> the records.
>> >> 
>> >> 
>> >> Please advise whether this is possible/recommended
>> way or
>> >> not.
>> >> 
>> >> thanks
> 
> 
>       
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> 

-- 
View this message in context: http://www.nabble.com/inserting-collection-of-facts-tp20374245p20389930.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list