This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Thread pool of servlet 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 "Thread pool of servlet" Watch "Thread pool of servlet" New topic

Thread pool of servlet

Hariom Tiwari

Joined: Jun 15, 2008
Posts: 10
Is there any way to set Thread pool size for a particular/general servlet?
Steve Luke

Joined: Jan 28, 2003
Posts: 4167

Probably not. This would generally be server dependent. On some servers you would be able to control the total number of simultaneous requests - which would define the thread pool size, or vice versa. But I don't know any that control how many threads can access a single Servlet.

Why do you want to do this?

Hussein Baghdadi
clojure forum advocate

Joined: Nov 08, 2003
Posts: 3476

I'm not sure but it looks to me as an application-specific issue.
AFAIK, JEE specification doesn't indicate such a thing.
Hariom Tiwari

Joined: Jun 15, 2008
Posts: 10
just out of curiousity.
I guess there needs to be any such mechanism.In case thousands of requests come for a particular servlet ,wont performance drgrade?
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12761
There is a mechanism limiting the number of "simultaneous" requests but it is for the servlet container as a whole.

Think about it - the container has to take a request and examine it before it knows which servlet will process it.

Inside the servlet, you can control the number of requests actually being worked on by rejecting excess requests with some sort of message.

I agree. Here's the link:
subject: Thread pool of servlet
Similar Threads
Thread pool
Max number of threads in a JVM
Thread pool
Servlet pooling