wood burning stoves 2.0*
The moose likes Servlets and the fly likes Can we control number of threads of a servlet instance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Can we control number of threads of a servlet instance" Watch "Can we control number of threads of a servlet instance" New topic
Author

Can we control number of threads of a servlet instance

Raj Jindal
Ranch Hand

Joined: Jan 17, 2003
Posts: 50
Servlet specification says that Only a single instance of a servlet is created by the Container at startup time. If more than one user calls that servlet, an additional thread is created to serve the request.
I just want to know that Can we limit the number of threads ? In other words If one lakh (100,000 users) access the servlet at the same time. Will one lakh threads be created.
where can we specify that servlet engine can't create threads beyond a specified limit, If possible.
If no, where can we specify to limit the number of threads ?
Thanks in advance
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
Control of the number of requests that a servlet container will try to service "at one time" is what you are talking about. This varies by vendor - in Tomcat, look at the server.xml file Connector element. For example:

This says to limit the number of simultaneous requests to 75. I think the interpretation of acceptCount is that will accept that many connections but will only assign working Threads to the lesser number of 75.
Bill
 
 
subject: Can we control number of threads of a servlet instance
 
Similar Threads
don't create too much object?
Max number of threads in a JVM
No of AppServers under an instance
Threads for a servlet
Requests to Servlets