Thursday, 14 September 2017

You don't create multiple instances of servlet. The servlet engine creates a separate Thread for each request (up to some max number of Thread) The performance is related to the number of Threads, not the number of instances of the servlet.

Each request is processed in a separated thread. This doesn't mean tomcat creates a thread per request. There a is 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.

No comments:

Post a Comment