[rules-users] Jbilling Drools performance

Greg Barton greg_barton at yahoo.com
Wed May 19 03:20:40 EDT 2010


See attached project, DroolsBilling.
You can build it with Maven from the project directory: mvn clean package

To run it after building: java -jar target/DroolsBilling-1.0.jar <numRules> <numPhoneNumbersPerThread>
$ java -server -jar target/DroolsBilling-1.0.jar 100 100000Rules load time: 3482msRules execution time: 732ms, per number: 0.00732msRules execution time: 731ms, per number: 0.00731msRules execution time: 746ms, per number: 0.00746msRules execution time: 760ms, per number: 0.0076msRules execution time: 832ms, per number: 0.00832msRules execution time: 623ms, per number: 0.00623msRules execution time: 600ms, per number: 0.0060msRules execution time: 632ms, per number: 0.00632msRules execution time: 630ms, per number: 0.0063msRules execution time: 607ms, per number: 0.00607msDONE!
At higher numbers of rules you have to increase the perm gen and heap memory:
$ java -server -Xmx1024M -XX:MaxPermSize=128M -jar target/DroolsBilling-1.0.jar 10000 100000Rules load time: 58317msRules execution time: 1580ms, per number: 0.0158msRules execution time: 1580ms, per number: 0.0158msRules execution time: 1586ms, per number: 0.01586msRules execution time: 2493ms, per number: 0.02493msRules execution time: 2502ms, per number: 0.02502msRules execution time: 1360ms, per number: 0.0136msRules execution time: 1358ms, per number: 0.01358msRules execution time: 1376ms, per number: 0.01376msRules execution time: 473ms, per number: 0.00473msRules execution time: 489ms, per number: 0.00489msDONE!
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.
A Sample.drl is included that shows the format of the rules generated, basically this:
rule "PhoneNumber000000000"	when		p : PhoneNumber( digit0 == '0', digit1 == '0', digit2 == '0', digit3 == '0', digit4 == '0', digit5 == '0', digit6 == '0', digit7 == '0', digit8 == '0', digit9 == '0')	then		p.setPrice(0.0);end
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.

--- On Tue, 5/18/10, Antonio Anderson Souza <antonio at voicetechnology.com.br> wrote:

From: Antonio Anderson Souza <antonio at voicetechnology.com.br>
Subject: Re: [rules-users] Jbilling Drools performance
To: "Rules Users List" <rules-users at lists.jboss.org>
Date: Tuesday, May 18, 2010, 4:11 PM

Greg, 



CDR is a Call Detail Record, sorry I forgot to explain it, the object is
 a POJO with the following attributes:


field: name: datereference type: DATE value: 2010-04-28 00:00:00.0

field: name: billingid type: STRING value: 20100428.15544.42adf

field: name: accountid type: INTEGER value: 15544

field: name: billingperiod type: STRING value: 20100401

field: name: billingclassification type: STRING value: DUR

field: name: ipxcallguid type: STRING value: 
5k692927-guwtka-g8kj8d0u-1-g8krry54-o4n

field: name: transactiondatetime type: DATE value: 2010-04-28 
20:21:01.337

field: name: billingitemid type: INTEGER value: 0

field: name: ratesystem type: STRING value: IPXNET

field: name: originnumber type: STRING value: 
551135880520 at bitcompany.braste

field: name: destinationnumber type: STRING value: 551139012650

field: name: destinationareaid type: STRING value: 100000551

field: name: chargedduration type: DATE value: 1980-01-01 00:02:06.0

field: name: chargedamount type: FLOAT value: 0.0816

field: name: userid type: INTEGER value: 3372

field: name: username type: STRING value: bitcom51

field: name: unitamount type: FLOAT value: 0.00389

field: name: amountcurrency type: STRING value: USD

field: name: timezone type: INTEGER value: -3

field: name: registertype type: STRING value: MV

field: name: datelastupdated type: DATE value: 2010-04-29 02:57:18.54

field: name: lastupdatedby type: STRING value: IPXRateCalls rev032

field: name: lastupdateremarks type: STRING value: null

field: name: dateinserted type: DATE value: 2010-04-29 02:57:18.54

field: name: destinationdetail type: STRING value: SAO PAULO

field: name: type type: STRING value: Fixo

field: name: collectedcallflag type: INTEGER value: 0

field: name: jb_timestamp type: DATE value: null

field: name: digit0 type: INTEGER value: 5

field: name: digit1 type: INTEGER value: 5

field: name: digit2 type: INTEGER value: 1

field: name: digit3 type: INTEGER value: 1

field: name: digit4 type: INTEGER value: 3

field: name: digit5 type: INTEGER value: 9

field: name: digit6 type: INTEGER value: 0

field: name: digit7 type: INTEGER value: 1

field: name: digit8 type: INTEGER value: 2

field: name: digit9 type: INTEGER value: 6

field: name: digit10 type: INTEGER value: 5

field: name: digit11 type: INTEGER value: 0


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.

Best regards,

Antonio Anderson Souza


Voice Technology
http://www.antonioams.com



2010/5/18 Greg Barton <greg_barton at yahoo.com>


OK, so a few questions:

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?



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100519/9f6313d4/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DroolsBilling.tar.gz
Type: application/x-gzip
Size: 5892 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20100519/9f6313d4/attachment.gz 


More information about the rules-users mailing list