title: EMS Performance Issue
body: <p>I am writing a service which serves stateless incoming requests. The requests are all mathematical calculation, which does not take very long to execute ( max 2ms). </p>
  
  <p>I use Tibco EMS to communicate between client/server. A client library is provided which wraps the client side logic (e.g. convert data into EMS message etc) and send the request to a request queue. The server side processes the request and send the response into a separate queue. This works fine.</p>
  
  <p>The server side is multi-threaded. A new thread is created when a new incoming request is received. Requests are therefore handled concurrently.</p>
  
  <p>The server side uses one single EMS connection to the EMS server. However, because EMS Session is not thread safe, if I want to be able to write the response to EMS queue in each thread, I have to create one session for each thread using the connectionFactory. This degraded the performance. </p>
  
  <p>The time spent on traffic is around 3-4ms, i.e. Time between a request is sent and a response is received is around 5-6ms.(3-4ms for transportation, marshal/unmarshal, 2ms for calculation).</p>
  
  <p>Is there any solution which allows me to concurrently send to a EMS queue without creating two much JMS objects? </p>
  
  <p>Are there any other important rules I need to follow to further optimize the service? Some basic optimization guidelines are already followed:</p>
  
  <ol>
  <li>Use CachedConnectionPool</li>
  <li>Send JMS message as NON_PERSISTANT</li>
  <li>Use one EMS connection for all requests.</li>
  </ol>
  
  <p>Thank you very much.</p>