Difference between single thread and multi thread model servlet


Answered by Scott on 2005-05-12 10:39:32: A servlet that implements SingleThreadModel means that for every request, a single servlet instance is created. This is not a very scalable solution as most web servers handle multitudes of requests. A multi-threaded servlet means that one servlet is capable of handling many requests which is the way most servlets should be implemented. 
 
A single thread model for servlets is generally used to protect sensitive data ( bank account operations ).

Showing Answers 1 - 3 of 3 Answers

Pooja Gupta

  • Apr 13th, 2005
 

Single thread model means instance of the servlet gets created for each request recieved. Its not thread safe whereas in multi threaded only single instance of the servlet exists for what ever # of requests recieved. Its thread safe and is taken care by the servlet container.

  Was this answer useful?  Yes

Scott

  • May 12th, 2005
 

A servlet that implements SingleThreadModel means that for every request, a single servlet instance is created. This is not a very scalable solution as most web servers handle multitudes of requests. A multi-threaded servlet means that one servlet is capable of handling many requests which is the way most servlets should be implemented. 
 
A single thread model for servlets is generally used to protect sensitive data ( bank account operations ).

  Was this answer useful?  Yes

chandra_raya

  • Jul 12th, 2006
 

Hi,

As the name says Singlethread means only one thread, can access the service method of the servlet, to reduce the overhead the servlet container creates pool of servlet instances to handle n number of request that is depend on the servler configuration

thanks

chandra

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions