How does a single servlet handle multiple requests from client side

Each request is processed in a separated thread. This doesn't mean Tomcat creates a new thread per request. There is a pool of threads to process requests. Also there is a single instance for each servlet and this is the default case.(Some more information). Your servlet should be Thread Safe i.e. it should be stateless.

enter image description here

If your servlet implements SingleThreadModel interface, each thread uses separate instance of servlet. SingleThreadModel is deprecated, Don't use it.

SingleThreadModel

I made this answer as community wiki.


Struts/Spring frameworks are actually written on top of Servlet specification so doesn't matter what you use underneath it use Servlets.

You are right, Only single instance of Servlet is created, but that instance is shared across multiple threads. For this reason you should never have shared mutable states in your Servlets.

For example you have following servlet mapped to http://localhost/myservlet

class MySerlvet extends HttpServlet {

     public void doGet(HttpServletRequest req, HttpServletResponse res) {
          // Get Logic
     }    
}

The Web Server will have something similar (Not necessarily same) in its code.

MyServlet m = new MyServlet(); // This will be created once

// for each request for http://localhost/myservlet
executorService.submit(new RequestProcessingThread(m));