<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">See attached project, DroolsBilling.<div><br></div><div>You can build it with Maven from the project directory: mvn clean package<br><br></div><div>To run it after building: java -jar target/DroolsBilling-1.0.jar <numRules> <numPhoneNumbersPerThread></div><div><br></div><div><div>$ java -server -jar target/DroolsBilling-1.0.jar 100 100000</div><div>Rules load time: 3482ms</div><div>Rules execution time: 732ms, per number: 0.00732ms</div><div>Rules execution time: 731ms, per number: 0.00731ms</div><div>Rules execution time: 746ms, per number: 0.00746ms</div><div>Rules execution time: 760ms, per number: 0.0076ms</div><div>Rules execution time: 832ms, per number: 0.00832ms</div><div>Rules execution time: 623ms, per number: 0.00623ms</div><div>Rules execution time: 600ms, per number: 0.0060ms</div><div>Rules execution time: 632ms, per number:
0.00632ms</div><div>Rules execution time: 630ms, per number: 0.0063ms</div><div>Rules execution time: 607ms, per number: 0.00607ms</div><div>DONE!</div><div><br></div></div><div>At higher numbers of rules you have to increase the perm gen and heap memory:</div><div><br></div><div><div>$ java -server -Xmx1024M -XX:MaxPermSize=128M -jar target/DroolsBilling-1.0.jar 10000 100000</div><div>Rules load time: 58317ms</div><div>Rules execution time: 1580ms, per number: 0.0158ms</div><div>Rules execution time: 1580ms, per number: 0.0158ms</div><div>Rules execution time: 1586ms, per number: 0.01586ms</div><div>Rules execution time: 2493ms, per number: 0.02493ms</div><div>Rules execution time: 2502ms, per number: 0.02502ms</div><div>Rules execution time: 1360ms, per number: 0.0136ms</div><div>Rules execution time: 1358ms, per number: 0.01358ms</div><div>Rules execution time: 1376ms, per number: 0.01376ms</div><div>Rules execution time: 473ms, per number:
0.00473ms</div><div>Rules execution time: 489ms, per number: 0.00489ms</div><div>DONE!</div><div><br></div><div>As you can see the time to process one phone number is lower than 1 minute. :) The example uses 5 concurrent threads and was executed on a 4 core machine.</div><div><br></div><div>A Sample.drl is included that shows the format of the rules generated, basically this:</div><div><br></div><div><div>rule "PhoneNumber000000000"</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>when</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>p : PhoneNumber( digit0 == '0', digit1 == '0', digit2 == '0', digit3 == '0', digit4 == '0', digit5 == '0', digit6 == '0', digit7 == '0', digit8 == '0', digit9 == '0')</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>then</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>p.setPrice(0.0);</div><div>end</div><div><br></div><div>They
should be substantially similar to the rules generated behind the decision table you've given, so the performance should be similar. As you can see from the times above, rule creation is expensive but execution is cheap. As Mark said, reuse the KnowledgeBase.</div></div><div><br></div><div><br></div>--- On <b>Tue, 5/18/10, Antonio Anderson Souza <i><antonio@voicetechnology.com.br></i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Antonio Anderson Souza <antonio@voicetechnology.com.br><br>Subject: Re: [rules-users] Jbilling Drools performance<br>To: "Rules Users List" <rules-users@lists.jboss.org><br>Date: Tuesday, May 18, 2010, 4:11 PM<br><br><div id="yiv372529383">Greg, <br>
<br>
CDR is a Call Detail Record, sorry I forgot to explain it, the object is
a POJO with the following attributes:<br><br>
field: name: datereference type: DATE value: 2010-04-28 00:00:00.0<br>
field: name: billingid type: STRING value: 20100428.15544.42adf<br>
field: name: accountid type: INTEGER value: 15544<br>
field: name: billingperiod type: STRING value: 20100401<br>
field: name: billingclassification type: STRING value: DUR<br>
field: name: ipxcallguid type: STRING value:
5k692927-guwtka-g8kj8d0u-1-g8krry54-o4n<br>
field: name: transactiondatetime type: DATE value: 2010-04-28
20:21:01.337<br>
field: name: billingitemid type: INTEGER value: 0<br>
field: name: ratesystem type: STRING value: IPXNET<br>
field: name: originnumber type: STRING value:
551135880520@bitcompany.braste<br>
field: name: destinationnumber type: STRING value: 551139012650<br>
field: name: destinationareaid type: STRING value: 100000551<br>
field: name: chargedduration type: DATE value: 1980-01-01 00:02:06.0<br>
field: name: chargedamount type: FLOAT value: 0.0816<br>
field: name: userid type: INTEGER value: 3372<br>
field: name: username type: STRING value: bitcom51<br>
field: name: unitamount type: FLOAT value: 0.00389<br>
field: name: amountcurrency type: STRING value: USD<br>
field: name: timezone type: INTEGER value: -3<br>
field: name: registertype type: STRING value: MV<br>
field: name: datelastupdated type: DATE value: 2010-04-29 02:57:18.54<br>
field: name: lastupdatedby type: STRING value: IPXRateCalls rev032<br>
field: name: lastupdateremarks type: STRING value: null<br>
field: name: dateinserted type: DATE value: 2010-04-29 02:57:18.54<br>
field: name: destinationdetail type: STRING value: SAO PAULO<br>
field: name: type type: STRING value: Fixo<br>
field: name: collectedcallflag type: INTEGER value: 0<br>
field: name: jb_timestamp type: DATE value: null<br>
field: name: digit0 type: INTEGER value: 5<br>
field: name: digit1 type: INTEGER value: 5<br>
field: name: digit2 type: INTEGER value: 1<br>
field: name: digit3 type: INTEGER value: 1<br>
field: name: digit4 type: INTEGER value: 3<br>
field: name: digit5 type: INTEGER value: 9<br>
field: name: digit6 type: INTEGER value: 0<br>
field: name: digit7 type: INTEGER value: 1<br>
field: name: digit8 type: INTEGER value: 2<br>
field: name: digit9 type: INTEGER value: 6<br>
field: name: digit10 type: INTEGER value: 5<br>
field: name: digit11 type: INTEGER value: 0<br>
<br>This spreadsheet is only a sample because the whole one has 40000 rules, I'm checking the Jbilling code, but it seams to be loading the rules each time.<br><br>Best regards,<br><br clear="all">Antonio Anderson Souza<br>
Voice Technology<br><a rel="nofollow" target="_blank" href="http://www.antonioams.com">http://www.antonioams.com</a><br>
<br><br><div class="gmail_quote">2010/5/18 Greg Barton <span dir="ltr"><<a rel="nofollow" ymailto="mailto:greg_barton@yahoo.com" target="_blank" href="/mc/compose?to=greg_barton@yahoo.com">greg_barton@yahoo.com</a>></span><br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex;">
<table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font:inherit;" valign="top">OK, so a few questions:<br><br>What is a CDR? How much data does it contain? Do you load the rules fresh each time you process one? Are there other rules besides the ones listed in the decision table?<div class="im"><br></div></td></tr></tbody></table></blockquote></div></div></blockquote></div></td></tr></table><br>