[rules-users] Hibernate Configuration with Drools 5.4

Wolfgang Laun wolfgang.laun at gmail.com
Tue Jun 19 04:59:07 EDT 2012


The problem discussed in this thread arises from a spreadsheet where 6
values are to be matched (==) with fact object properties, resulting
in the setting of a single attribute in the field. The spreadsheet has
26400 lines, resulting in so many rules that merely differ in the
values of the literals.


(1) Compile and execute from XLS

Compiling takes a lot of time and memory. Heap and PermGen memory
sizes must be increased, and compiling the Knowledge Packages takes
68sec (2.8GHz, dual core).

The frequently proposed serialization for a faster startup from
knowledge packages backfires: After serializing the KPs in 34sec to a
17MB file, loading the KPs to create the KB takes 78sec. (The code was
taken from the Expert manual, of course without the syntax error.)

Execution is fast enough: 10,000 facts can be processed in just about 2sec.


(2) Improving the XLS

One of the columns varies between three values but without any change
in the single result. This appears to indicate that the number of
rules can be reduced to one third. But the target (according to OP) is
~50,000 lines, so even that doesn't help very much.


(3) Alternative Solution

After conversion to CSV, read the spreadsheet data and create one
object per row, containing the 6 values and the result value. Insert
these objects into WM, running with a single rule, matching the
transaction fact with the "row" facts, and setting the result. A
single rule compiles in almost no time at all; reading the 26400 text
lines and inserting them as facts is done in a little less than 1sec.
And execution appears to be faster; 10,000 facts now take 0.66sec


(4) Conclusion

Left to the reader.

-W


More information about the rules-users mailing list