title: How are Threads allocated to handle Servlet request?
body: <p>Can someone please explain what is thread per request and thread per connection? Which model do servlets work on? How threads are allocated to handle HTTP requests? Is it thread/request or connection?</p>
  
  <p>And let's say if I want to perform a time consuming task in my <code>Servlet</code>'s <code>doGet()</code> method asynchronously, I start a new thread using Java executors so that lengthy calculations are done in a separate thread and response is sent right away.</p>
  
  <p>Now does that ensure that I have freed the thread which had been processing my <code>HttpServletRequest</code> or is it still being used because a child thread is still running?</p>