views:

632

answers:

1

In terms of JMS performance, I have read that ObjectMessage should be avoided for performance reasons.

How bad are ObjectMessage performance-wise? Should I serialize to a BytesMessage and manually deserialize?

+4  A: 

The performance overhead of ObjectMessage is because of the java.io serialization process. If you do that yourself and use ByteMessage, you're just doing what JMS would do itself, and you'll be no better off.

If you need to send java objects via JMS, you should use ObjectMessage, that's what the API provides. This allows the container to make some optimizations, e.g. JBoss will use its own proprietary serialization protocol, which is considerably faster than the standard java.io one.

skaffman
This is what I thought too...
Tazzy531
I've been looking at Hessian Serialization. It seems to serializes objects to about 1/2 the space as Java Serialization. I haven't done any real tests yet, but it seems like using this+BytesMessage could be advantageous over ObjectMessage in this case.
Dave
I'd probably go with JBoss Serialization over Hessian/Burlap, but in principle yes, there are better alternatives to standard serialization.
skaffman