This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi gyes.. I have a little doubt... As the life cycle of servlets says that the container will create one instance per servlet at startup or when the 1st request comes up for the servlet. If other requests come in by that time the container will see if there is any intance of that servlet is existing if its there than a new thread will be processing the second request.. and same for other request also.. Now if my servlet is to be designed to handle 1000 request at a time.. will there be 1000 therads processing the request on behalf of Only single instance of that servlet or we can have different concept to do that..(as far as i know instance pooling is available only for the servlet which implements Single Thread Model)... Thanx in advance.... Bish [ March 01, 2004: Message edited by: Bis Bang ]
The glory lies not in not falling, but it lies in rising everytime you fall
Yes, there would be 1000 threads running through a single servlet at the same time, but this is a good thing! Think how quickly your server would run out of memory, if there was a separate servlet for each request. It's a common misunderstanding, but believe me, you don't need separate instances to make your application go faster. Each thread only needs to read the servlet code, and lots of threads can be reading the same code at the same time. An anology I have used before is that of a movie theater. You don't expect the movie to take longer just because a few more people come in to see it today. Does that make sense?