Dead simple rule engines benchmark test.
Currently implemented:
Jess version 7.1p2 is used here. jess.jar from Jess distribution must be available as Maven artifact to compile and run benchmark test.
You can install jess.jar to your local Maven repository by running the following command:
mvn deploy:deploy-file -DgroupId=jess -DartifactId=jess -Dversion=7.1p2 -Dpackaging=jar -Dfile=/jess_home_directory/lib/jess.jar -Durl=file:///path_to_your_home_directory/.m2/repository/
The case is based on the OpenL Tablets HelloExcelCustomer.xls example:
Each rule engine in test suit calculates and prints out greetings message for customer, based on customer's gender and marital status, and the hour of day. Input is randomly generated once beforehand and passed to each test.
Tests can be run in Maven's verify phase:
mvn clean verify
After successful run, the results will be displayed:
Sep 15, 2012 2:57:17 PM foo.bar.RuleEngineBenchmarkTest test
INFO: Drools 5.4.0.Final: 43.88 case/s (10 cases, 0.228s)
Sep 15, 2012 2:57:17 PM foo.bar.RuleEngineBenchmarkTest test
INFO: OpenL Tablets 5.9.3.1: 319.07 case/s (10 cases, 0.031s)
Sep 15, 2012 2:57:17 PM foo.bar.RuleEngineBenchmarkTest test
INFO: Jesse 7.1 Rete: 38.4 case/s (10 cases, 0.26s)
By default, the test will generate 5000 random test cases. You can set the number of test cases generated by setting the testCases property:
mvn verify -DtestCases=5000
Additionally, test can be configured to run 'warm-up' routine first. During warm-up run, a number of randomly generated test cases will run for all implemented tests, but the results will be ignored. Number of warm-up test cases can be set with warmUpTestCases property:
mvn verify -DtestCases=5000 -DwarmUpTestCases=100
If you want to run only particular tests, use tests property to set test names separated by comma:
mvn verify -Dtests=drools,jess
If you need to evaluate memory footprint, you can have a heap-dump file after the execution, by setting heapDumpFile property (works only on Sun JVM):
mvn verify -Dtests=drools -DheapDumpFile=drools.bin