Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JMS Connection Pooling or Session Pooling

I am confused between JMS Connection Pooling and JMS Session Pooling.

I have a Java application which has approximately 20 threads processing messages being received from a vendor product. Each thread peforms some processing of the message before pushing on to a JMS Topic(same topic for all 20 threads).

I want to ensure that there are no threads waiting for free JMS connections as performance is critical. However, when I look at the JMS Connection Factories I cannot see any way to configure a pool size for my JMS Connections.

Now I am really confused. Is it the JMS sessions I should be pooling?

Any help on this much appreciated

Thanks Joe

like image 633
user1496620 Avatar asked Jul 02 '12 16:07

user1496620


People also ask

What is connection pool session?

Each connection in the connection pool has its own session pool. This means that there can be 10 session pools that can have a maximum of 10 sessions each. Each session represents a TCP/IP connection to the queue manager. With the settings mentioned here, there can be a maximum of 100 TCP/IP connections.

What is JMS pool?

Use this page to define the configuration of this JMS session pool, a server-managed pool of server sessions that enables an application to process messages concurrently.

What is Connection Pooling What are the advantages of using a connection pool?

Using connection pools helps to both alleviate connection management overhead and decrease development tasks for data access. Each time an application attempts to access a backend store (such as a database), it requires resources to create, maintain, and release a connection to that datastore.

What is JMS session?

A session is a single-threaded context for producing and consuming messages. You use sessions to create the following: Message producers. Message consumers.


2 Answers

From the J2EE 6 api a javax.jms.Connection

typically represents an open TCP/IP socket between a client and the service provider software.

and

A Session object is a single-threaded context for producing and consuming messages.

A session (or a session pool) occurs in the context of a connection.

You probably want to determine whether to pool Sessions, Connections or neither of those based upon the cost of creating these resources from scratch in the context of your specific technology stack, frameworks and applications involved.

My resources:

  • http://docs.oracle.com/javaee/6/api/javax/jms/package-summary.html
  • Relationship between JMS connections, sessions, and producers/consumers
  • http://hjb.berlios.de/connections-sessions.html
  • http://www.precisejava.com/javaperf/j2ee/JMS.htm#JMS106
like image 70
eebbesen Avatar answered Oct 16 '22 11:10

eebbesen


I know one method from PooledConnectionFactory class using which you can set the max number of connection. method is setMaxConnections. this is however part answer of your question.

like image 45
Manglesh Avatar answered Oct 16 '22 11:10

Manglesh