same client, 100 requests: 1 Instance (including SingleThreadedModel servlet)
Why not 100 instances for 100 requests?
SCJP 5.0(75%), SCWCD 5.0(88%)
anil pamidi
Greenhorn
Joined: Apr 09, 2008
Posts: 15
posted
0
Hi Vishal even I have the same doubt as Pradeep.
quote: -------------------------------------------------------------------------------- same client, 100 requests: 1 Instance (including SingleThreadedModel servlet) -------------------------------------------------------------------------------- why not 100 instances in the case of SingleThreadModel?
The only thing CONSTANT in life is CHANGE.
SCJP 1.4, Preparing for SCWCD 5
Atul Sawant
Ranch Hand
Joined: Jul 06, 2006
Posts: 304
posted
0
Everytime you send a request it is a new request for the server because HTTP communication is stateless. So, it does not matter if it is a same client or different client. Every request is treated as unique and different.
If you apply singleThreadModel, the instance of that servlet is giving to only one thread (request) at a time. it is NOT creating 100 instances for 100 requests. The instance will be only one, but it will be accessed by one thread (request) at a time.
i would like to add one thing with single thread model, it is upon vendor implementation whether it allows container to create multiple instances for serving multiple requests or to serve only one request while making others to wait requesting the same servlet .The only point here is that with standard servlet model one instance and multiple threads for serving different requests for same servlet.anyways we are not going to use single thread model.Am i right
isnt there something called container dependent?? :?
sudhakar karnati
Ranch Hand
Joined: May 03, 2007
Posts: 93
posted
0
Hi All,
Even i had this doubt..now it is clear... Can any body give me a link for resource where i can read about this.
Thanks & Regards, Sudhakar Karnati
Charles Lyons
Author
Ranch Hand
Joined: Mar 27, 2003
Posts: 836
posted
0
Can any body give me a link for resource where i can read about this.
Section 2.3.3 ("Request Handling") of the Servlet 2.4 specification.
Charles Lyons (SCJP 1.4, April 2003; SCJP 5, Dec 2006; SCWCD 1.4b, April 2004)
Author of OCEJWCD Study Companion for Oracle Exam 1Z0-899 (ISBN 0955160340 / AmazonAmazon UK )
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.