title: Multithreading In Jersey REST API
body: <p>Let me explain with an example, suppose there is a REST API say /getUsers
  and now this API needs to collect data from 3 to 5 other systems say system1, system2 and system3 and send the combined result back as a response of /getUsers API.</p>
  
  <p>Now in order to reduce the processing time I would like to make calls to system1/2/3 parallel using multi threading.</p>
  
  <p>What are some of the good approaches to process such request using multithreading in the REST API? like should I maintain my own thread pool and executors or should use one provided by jersey or servlet container? what would be the impact and how to handle when the number of concurrent requests increase?</p>
  
  <p>I am okay with clients waiting for the response and don't want to take approach of queuing the requests and sending HTTP 202 and later processing them. I am also aware of jersey async apis but I more looking towards optimizing the processing time within the API</p>
  
  <p>I do realize it is a bit of a broader question, just looking out for some tried and tested design and techniques to process such requests.</p>
  
  <p>I am using Jersey REST implementation, Tomcat Server and application is Java based.</p>
  
  <p>Regards</p>