[rules-users] Loading rules

Michael Neale michael.neale at gmail.com
Thu Oct 30 01:27:31 EDT 2008


yeah you DO NOT want to be rebuilding rules on each request - that
would really be bad.

you can load and cache them, and do a check on each request to see if
you need to update the cache - that is possible, and reasonable.

On Sat, Oct 25, 2008 at 4:53 AM, Chris Chen <ckchris at echomine.com> wrote:
> I have a simple beginners question about using rules.
>
> Say that I have a set of rules that are static and exist in drl files to
> deal with product pricing.  But then I also have a set of dynamic rules
> stored in the database for different promotions.  Depending on the promotion
> entered or selected, the dynamic rule is retrieved from the promotion db
> row.
>
> Based on this criteria, I have some quick questions that I hope someone can
> help give me answers:
>
> 1) Is it good practice to be loading rules, add them to packages, compile,
> and create the RuleBase for every incoming request?  I take it that's not a
> very efficient way to load the rules. It's probably better to keep the
> compiled rule engine available and simply create the RuleBase for every
> incoming request instead.
>
> 2) Would it be better then to create two rules engine - 1 for the static drl
> files that do not change and one for the dynamic rules that gets refreshed
> and loaded every time?
>
> 3) Another alternative is to load ALL the promotions rules in the DB into
> one rule engine and make sure to check promotion codes on each run.  This
> seems to be efficient.  however, how would I know when the DB promotions
> have changed so that I can reload the rules?  I can think of a couple ways.
>  One is to do periodic cache flushing which will refresh the rules engine
> every once in a while.  The other way is to query modification dates and see
> if any promotions were modified since the last time the rules engine was
> loaded.  There could be a third way, which combines the previous two ways
> together.
>
>
> I'd like to know if there is some best practice when it comes to dynamic
> rule reloading and what is an efficient and scalable way to do this.
>
> Thanks for any thoughts or suggestions!
>
> -Chris
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
Michael D Neale
home: www.michaelneale.net
blog: michaelneale.blogspot.com



More information about the rules-users mailing list