Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how many instances???

 
Swati Kadam
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how many objects are created when same or different client send 100 requests to a servlet?
 
sammeta Phanikumar
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Only one instance(object) is created for one servlet and for each request for this servlet a seperate thread will be created.
 
Vishal Matere
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
same client, 100 requests: 1 Instance (including SingleThreadedModel servlet)
Diff Client, 100 request: 100 instances (SingleThrededModel servlet)
Diff Client, 100 request: 1 instances (Normal Servlet)

HTH
 
pradeep singh
Ranch Hand
Posts: 339
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

same client, 100 requests: 1 Instance (including SingleThreadedModel servlet)


Why not 100 instances for 100 requests?
 
anil pamidi
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Atul Sawant
Ranch Hand
Posts: 304
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
vishal_kumar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

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

Scjp 5.0
Prp for SCWCD5.0
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
 
Abi Ted
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ah er hum....

isnt there something called container dependent?? :?
 
sudhakar karnati
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 836
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic