Is there any performance difference between sending ObjectMessage and TextMessage of same size to JMS Queue. TextMessage contains just xmlstring only, but ObjectMessage contains lot of other objects and primitive data types. Here keep in mind the contents of TextMessage object is same as ObjectMessage object. May be size also same. I am waiting for your reply Thanks and Regards Venkateswara Rao
David Weitzman
Ranch Hand
Joined: Jul 27, 2001
Posts: 1365
posted
0
Sending an ObjectMessage would be sort of like using serizlized bytes instead of xml in a TextMessage. I'm not too familiar with the JMS specs but it may be possible for a JMS provider to pass the object directly in memory without ever serializing it, which could possible change the equation depending on your specific software setup. You might want to write a few tests to see if you can (de)serialize to XML as fast as ObjectOut/InputStream (de)serializes. I would guess that XML has more overhead, but you might be able to counter the fact that ObjectOutputStream needs to use reflection and figure stuff out at runtime. The other issue is memory. Serialized objects should be packed pretty efficiently in binary, but it's possible that you could end up storing unnecessary data and/or run into object version incompatability problems. I suggest that you do a few quick test to compare the speed and memory requirements of each option. If there isn't a big performace difference, I'd be inclined to go with XML just because it's more adaptable and extensible.