[rules-users] serialization size: a switch in Drools 2.5 ?

writetochristoph writetochristoph at gmail.com
Mon Sep 24 05:19:26 EDT 2007


Hi!

I have a server which uses a Drools RuleBase to evaluate about 2500 rules.
The server stores the Drools RuleBase in a database as a serialized java
object. I also need to transfer the Drools RuleBase to clients for offline
usage. For the server, I need fast loading of the Drools RuleBase. For
transfer to the client, I need the serialized Drool RuleBase to be as small
as possible. You see, there is a trade-off here which I have to cope with.
I have to use Drools 2.x i.e. Drools 2.1 or Drools 2.5 repectively. I have
to do so because the rules have been written for Drools 2.x. And my company
doesn't want to migrate the rules because there are about 2500 ones.
We used to use Drools 2.1. Serialized Drools RuleBases of Drools 2.1 are
very small because there're large parts which aren't serialized because
they're transient. The size of the serialized Drools RuleBase of Drools 2.1
is a few hundred kB. Therefore transfering the Drools RuleBase to a client
is feasible. But since the transient parts haven't been saved, they'll have
to be recreated after the Drools RuleBase is deserialized. And this takes
time - too much time (a couple of minutes!). This will especially be a
problem if you often change the active Drools RuleBase. (And sadly, we'll
have to do that in the future.)
So we decided to try Drools 2.5. In Drools 2.5 the evaluation tree for the
rules is no longer transient, it will stored in the database if the Drools
RuleBase is serialized. Hence, it won't have to be recreated after
deserialization because it will already be there. Therefore I'm able to load
and reuse a serialized Drools RuleBase in no time. But since more
information is stored, the serialized object of a Drools RuleBase has grown.
And it has grown a lot: The size of a serialized Drools RuleBase in Drools
2.5 is about 10MB (with using GZIP for compression!). This is much to much
information to transfer to a client!
What I'd need is a switch which will allow to switch between serialization
to a small serialized object (which may take a long time to load like in
Drools 2.1) and serialization to a big serialized object (which can be
loaded extremely fast but which may be to big to be transferred anywhere).
By doing so, I could tranfer the small serialized Drools RuleBase to a
client. And then the client can create the "big version" when he stores the
Drools RuleBase for the first time. In this way, I wouldn't have to transfer
much data and the problem with slow loading of the Drools RuleBase would
occur only once.

Is there a switch in Drools 2.5 to decide whether ot not the evaluation tree
is stored in the serialized object?

By the way, transferring the rules to the client and letting the client
build the Drools RuleBase itself is definitely not feasible. Building the
Drools RuleBase takes too much memory and too much time. The clients which
are going to run the offline version will mostly be laptops with limited
processing power.

Yours sincerely,
Christoph
-- 
View this message in context: http://www.nabble.com/serialization-size%3A-a-switch-in-Drools-2.5---tf4508007.html#a12856495
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list