Can i set the no of threads per servlet in web.xml?
Joined: Nov 05, 2004
Is there a way to set the no of threads of the web container(tomcat) to allocate a fixed no of threads on a per servlet basis in say the web.xml or any other way?
Joined: Oct 12, 2000
no. A servlet container will launch at most one instance of every servlet defined in the web.xml and will thereafter create a single thread for each concurrent request to that servlet.
Author and all-around good cowpoke
Joined: Mar 22, 2000
Limiting the number of Thread is possible but it is not part of the servlet API and web.xml. With the Tomcat server, look at the server.xml file entry:
It is up to each server architect to provide for limiting simultaneous request processing Threads. In this case it is the whole port 80 Connector that is limited, not the individual servlet. If you want to control the number of requests per servlet you will have to write your own code. Bill