I have gone through some of the posts and understood below concept.
1. In SingleThreadModel for every new request separate instance of servlet will be created and request will be serviced once completed instance will be destroyed for performance improvement some vendors pool the servlet insatnces and reuse the instance to provide service. However those information at application level like session and other shared resources will be still shared by two threads using two separate instances of servlets.
2. In multi threaded environment there will be only one insatnce of the servlet and for each request new thread will be created but all the threads will access same single insatnce of servlet. However when the load is too heavy on the instance container can create new instnce for performance improvement.
Is my understanding correct.
Originally posted by vishwa raj:
However when the load is too heavy on the instance container can create new instnce for performance improvement.
This part is false.
Look at SRV.2.2 in the servlet spec (link in my signature):
SRV.2.2 Number of Instances
The servlet declaration which is part of the deployment descriptor of theWeb application
containing the servlet, as described in Chapter SRV.13, �Deployment
Descriptor�, controls how the servlet container provides instances of the servlet.
For a servlet not hosted in a distributed environment (the default), the servlet
container must use only one instance per servlet declaration. However, for a servlet
implementing the SingleThreadModel interface, the servlet container may
instantiate multiple instances to handle a heavy request load and serialize requests
to a particular instance.
Containers (as David mentioned) may pool the threads that access your servlet but not the servlet itself.