tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthew Dornquast" <matt...@cata.com>
Subject Re: Session Serialize code
Date Fri, 29 Dec 2000 14:59:07 GMT
Hi Guys,

I worked quite a bit with apache serialization code a several months back on
various VM's speeding it up.  I think I have several observations that I
hope you'll consider before using the code I just saw fly by on the list.

Basically, I'm a proponent of using externalizable for the session object.
My tests show the objects are smaller and less resources are required to
serialize/deserialize the object.

Use the strategy in class TestObject_D and you'll serialize objects in less
time with less storage.

The simple proof of the idea is in the attached file SerialDemo1.java.

Here you'll find your basic contendors for the "I'm best way to serialize
sessions" contest:

TestObject_A is your standard no frills serializable object.  What most
people do.  What 3.1 did.
TestObject_B is what happen's when you attempt to speed things up a bit.
(Like the code I just saw on mailing list)
TestObject_C is shows how String writing can be made better. (HUGE
difference with JDK 1.1, less for 1.2/1.3)
TestObject_D shows the power of fully managing the serialization process.

Test results on a couple of platforms:

Results of SerialDemo1.java when run on Pentium II 450mhz w/Linux & IBM'S
JDK:
  Test results for test.TestObject_A: Total time required- 4540, size of
pickled object:99
  Test results for test.TestObject_B: Total time required- 2743, size of
pickled object:100
  Test results for test.TestObject_C: Total time required- 2699, size of
pickled object:101
  Test results for test.TestObject_D: Total time required- 1755, size of
pickled object:70

Results of SerialDemo1.java when run on 600mhz celery laptop in JBuilder's
JDK 1.3:

  Test results for test.TestObject_A: Total time required- 1763, size of
pickled object:99
  Test results for test.TestObject_B: Total time required- 1512, size of
pickled object:100
  Test results for test.TestObject_C: Total time required- 1412, size of
pickled object:101
  Test results for test.TestObject_D: Total time required- 1012, size of
pickled object:70

--------------

Now, if you're on board with the approach of  TestObject_D.  Take a look at
a class I wrote last summer.  It's called SerializationDemo.java.  This is a
full blown implementation/rewrite of the serialization process for sessions.

 (Sorry about the name, I didn't have time to change this class.)

It provide custom optimizations for all the popular data types that might
occur in a session and can be easily extended for custom types.
The class is called MattWay() (Again-- sorry about the name, this was for my
own tests) and is intended to serve as an example of how to fully manage the
serialization/deserialization of all the stuff a session might have in it.

Anyway, use this method, and you've got lean mean serialized objects that
take up the least amount of space possible and have the lowest overhead to
serialize/deserialize.

Warm regards,

-Matthew

PS> Test results for SerializationDemo.java on a 450 mhz pentinum using
jdk1.3:

Test=test.ApacheWay, testTime=34238, testSize=5021
Test=test.MattWay, testTime=12830, testSize=2351
Serialization peformance summary=166.85893% faster
Size          peformance summary=2670 bytes smaller

jdk 1.1:
Test=test.ApacheWay, testTime=33992, testSize=5037
Test=test.MattWay, testTime=11785, testSize=2336
Serialization peformance summary=188.43446% faster
Size          peformance summary=2701 bytes smaller


Mime
View raw message