<div>Hi,</div><div><br></div><div>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.<br></div><div><br></div>

<div>2) For what you&#39;ve described this seems to be the best option. Maybe one RuleBase for price and another for promotion.</div><div><br></div><div>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 &quot;real-time&quot; 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.</div>

<div><br></div><div><br></div><div>Regards,</div><div>Leo</div><div><br></div><div><br><div class="gmail_quote">On Fri, Oct 24, 2008 at 4:53 PM, Chris Chen <span dir="ltr">&lt;<a href="mailto:ckchris@echomine.com" target="_blank">ckchris@echomine.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I have a simple beginners question about using rules.<br>
<br>
Say that I have a set of rules that are static and exist in drl files to deal with product pricing. &nbsp;But then I also have a set of dynamic rules stored in the database for different promotions. &nbsp;Depending on the promotion entered or selected, the dynamic rule is retrieved from the promotion db row.<br>


<br>
Based on this criteria, I have some quick questions that I hope someone can help give me answers:<br>
<br>
1) Is it good practice to be loading rules, add them to packages, compile, and create the RuleBase for every incoming request? &nbsp;I take it that&#39;s not a very efficient way to load the rules. It&#39;s probably better to keep the compiled rule engine available and simply create the RuleBase for every incoming request instead.<br>


<br>
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?<br>
<br>
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. &nbsp;This seems to be efficient. &nbsp;however, how would I know when the DB promotions have changed so that I can reload the rules? &nbsp;I can think of a couple ways. &nbsp;One is to do periodic cache flushing which will refresh the rules engine every once in a while. &nbsp;The other way is to query modification dates and see if any promotions were modified since the last time the rules engine was loaded. &nbsp;There could be a third way, which combines the previous two ways together.<br>


<br>
<br>
I&#39;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.<br>
<br>
Thanks for any thoughts or suggestions!<br>
<br>
-Chris<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote></div><br></div>