3 Replies Latest reply on Feb 15, 2007 3:00 PM by clebert.suconic

    Does JBossSerialization improves performance for Entrnaizabl


      In our application we are serializing Externalizable objects. In writeExternal(), we basically converting the data into byte[] and writing them into the streams in writeExternal() and readExternal() methods.

      But when we initially call writeObject() and readObject() methods, they are taking much of the CPU cycles.

      Can we avoid that overhead if we use JBossSerialization?


        • 1. Re: Does JBossSerialization improves performance for Entrnai

          Why do you need to convert your object to bytes inside writeExternal?
          Why not just use the DataOutput to write your data?

          I would need an example to say more than that.

          • 2. Re: Does JBossSerialization improves performance for Entrnai

            As the DataOutputStream also writes the primitives by converting them into bytes and writing the bytes into stream, we thought of converting them ahead and writing the byteArray.

            we use some thing like this

            public byte[] convertInt(int value) {
            return new byte[]{
            (byte) (value >>> 24), (byte) (value >>> 16), (byte) (value >>> 8), (byte) (value >>> 0),
            (byte) 0, (byte) 0, (byte) 0, (byte) 0};

            and this byte[] we write into the stream in writeExternal() method.

            public void writeExternal(final ObjectOutput out) throws IOException {

            This Externalizable object is a subclass of another parent object and we serialize that parent object like this.

            PartenObject po = new ParentObject();

            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteArrayOutputStream);


            But we see much overhead when we call this writeObject() method.

            So are there any optimizations in Jboss Serialization in this redard..

            • 3. Re: Does JBossSerialization improves performance for Entrnai

              I don't think this write(bytes[]) would be any different...

              But you could give it a try with JBoss Serialization to see how it goes.