Search code examples
javamultithreadingjmsjndi

JMS Multiple threads processing


We have a web application that is generating some 3-5 parallel threads every five seconds to connect to a JMS/JNDI connection pool. We wait for the first batch of parallel threads to complete before creating next batch of parallel threads. During this process we are using a lot of network traffic and connection threads are just hanging. Eventually we manually call operations team to kill the connection threads to free up connections. Question I wanted to ask you is:

  • Obviously we are doing something wrong as we are holding up connection resources
  • When we wait for parallel threads to respond before sending second batch of requests,Does this design not resonate well with industry best practices?
  • Finally what are the options and recommendations you have for this scenario i.e. multiple threads connecting to JMS/JMDI connection

Thanks for your inputs


Solution

  • You need to adjust your connection pool parameters. It sounds like you're using up only 3-5 connections for your service, which seems very reasonable to me. A JMS service should be able to handle thousands of connections. Either your pool's default limit is too low, or your JMS server is configured with too few allowed connections.

    Are you sure that's what the other users are blocking on? It seems strange to me.