[rules-users] Loading rules

Leonardo Figueiredo leo.lists at gmail.com
Mon Nov 3 10:29:37 EST 2008


Hi,

1) I believe the best way for performance is to compile once and use it to
create a RuleBase. With a single RuleBase you can create a working memory
for every request.

2) For what you've described this seems to be the best option. Maybe one
RuleBase for price and another for promotion.

3) If you do not use a BRMS and a RuleManager you have to figure out for
yourself how to refresh the compiled rules. How to do it is determined by
how accurate and "real-time" you system needs to be. If you do not need to
apply the promotions at creation time load/compile the rules in an
pre-determined time.


Regards,
Leo


On Fri, Oct 24, 2008 at 4:53 PM, 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20081103/925525d0/attachment.html 


More information about the rules-users mailing list