tags:

views:

421

answers:

4

Our application uses a topic to push message to a small set of subscribers. what sort of things should i look for when modeling a jms message with respect to the size of the actual message to be pushed. Are there any known limits or is application server specific? Any best practices or suggestions on this topic (pun unintended)?

A: 

It is implementation specific. As you might expect, smaller is better. Tibco, for instance, recommends to keep message sizes under 100 KB.

Jeroen van Bergen
+3  A: 

You are likely to hit practical limits before you hit technical ones. That is, message lengths may have technical limits in the lengths that can be expressed in an int or long, but that's unlikely to be the first constraint you hit.

Message lengths up in the Megabytes tend to be heavyweight. Think in terms of a few K as the sort of ballpark you want to be in.

A technique used sometimes is to send small messages saying "Item 123435 has been updated", consumers then go retrieve data associated with Item 12345 from a database or other storage mechanism. Hence each client can get only the data they need, we don't spray large chunks of data around when subscribers may not need it all.

djna
"send small messages saying "Item 123435 has been updated", consumers"that's the epiphany i just had thinking abt the problem. thanks.
jjoshi
+2  A: 

I suggest you to check the book Enterprise Integration Patterns, where a lot of patterns dealing with issues like the one you are asking are exhaustively analyzed. In particular, if the size of your message is large, you can use Message Sequence to solve the problem:

Huge amounts of data: Sometimes applications want to transfer a really large data structure, one that may not fit comfortably in a single message. In this case, break the data into more managable chunks and send them as a Message Sequence. The chunks have to be sent as a sequence, and not just a bunch of messages, so that the receiver can reconstruct the original data structure.

Quoted from http://www.eaipatterns.com/MessageConstructionIntro.html

The home page for a brief description of each pattern of the book is available at http://www.eaipatterns.com/index.html

JuanZe
Bobby Woolf tells the truth that indeed people do do use Message Sequence. He also indicates that that it can hurt. In my experience it can hurt quite a lot. You tend to lose scalability options. Enterprise Integration Patterns indicates that the "Claim Check" pattern alluded to in my answer earlier is an alternative.
djna
@djna +1 Thanks for your comment, is very helpful. Contrasting real use experiences with patterns recommendations is always a great piece of advice.
JuanZe
A: 

Small messages are faster, obviously. Having said that, the underlying JMS server implementation may improve performance using, for instance, message compression, such as Weblogic 9. (http://download.oracle.com/docs/cd/E13222%5F01/wls/docs92/perform/jmstuning.html#wp1150012)

Luciano Fiandesio