I recently read a lot about best practices with JMS, Spring (and TIBCO EMS) around connections, sessions, consumers and manufacturers.
When working in the Spring world, prevailing wisdom seems
- for consuming / incoming streams - use
AbstractMessageListenerContainer with multiple consumers / streams. - To create / publish streams , use
CachingConnectionFactory under the JmsTemplate to support a single connection to the broker, and then cache the sessions and producers.
To create / publish, this is what my (large) server application does, where previously it created a new connection / session / producer for every single message that it published (poorly!) JmsTemplate to the use of a raw factory connection under JmsTemplate . Old behavior sometimes led to the creation of 1,000,000,000,000,000,000,000,000,000 brokers in a short period of time during periods of high peak and even falling within the descriptor / file descriptors.
However, when switching to this model, it is difficult for me to understand what performance limitations / considerations are associated with using one TCP connection with a broker. I understand that the JMS provider must ensure that it can be used in a multi-threaded way, etc., but from a practical point of view
- this is just one TCP connection
- To some extent, the JMS provider must coordinate the records down the channel so that they do not mix up with each other, even if there are several fragments in its internal protocol
- Of course, this is due to some conflicts between threads / sessions using the same connection.
- with certain network semantics (high latency for unstable broker bandwidth?), of course, one connection will not be ideal?
Assuming I'm a little on the right track
- Am I really out of order here and donβt understand how basic connections work and which the JMS provider uses?
- Is any statement a problem mitigated by having more connections or is it just transferring competition to a broker?
- Does anyone have any practical experience of reaching such a limit that they could share? Either with a specific message or network bandwidth, or even caused by # threads / sessions sharing a connection
- Should I keep in mind a single connection scenario about sessions that write very large messages that block other sessions that write small messages?
I would read any thoughts or pointers for more reading on this issue or experience, even with other brokers.
source share