Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet Instance

 
sai prasanna
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai all
If i had a servlet and 100 clients are requesting that servlet how many instances are created ? According to my analysis
init() method is initialized once and the service() method executes for each clients request so the servlet has one instance serving
100 clients.

thanks in advance
 
Sunny Kumar
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Only one instance is created and any new request by client generates a new thread which handles the client requests.
 
ramprasad madathil
Ranch Hand
Posts: 489
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is container specific. A container may choose to have, say, 50 threads per instance and when the number of current requests exceeds that, may create another instance. The exact number of instances and thread per instance is not cause for concern.

Ram.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic