tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: MaxPermSize / Threads
Date Mon, 17 May 2010 11:59:55 GMT
Ozgur Ozdemircili wrote:
> Hi,
> I have the default server.conf file with :
>  <Connector port="8080" protocol="HTTP/1.1"
>                maxThreads="250"
>                connectionTimeout="20000"
>                redirectPort="8443" />
> I do not have any Executor.
> When I check the manager status in detail I see the threads with ? in front
> and nothing else. The ones being used do have the data.
> Just wondering is it normal to have that much open threads waiting?
Let's get back to the basics for a minute.

How many requests are you expecting your server(s) to handle per unit of 
time, and how long does one request take to process ?
And, once you get one request from a client, how many subsequent 
follow-up requests do you expect that same client to send within any 
short period of time ?

I mean, above you have connectionTimeout set to 20 seconds.
That means :
- when a first request comes in from a browser, a thread will be 
allocated to process it. That thread will be busy with that one client, 
and that one connection, for the duration it takes to process that request.
- when that request is processed, this same thread will still wait for 
up to 20 seconds, doing nothing, just in case the same client, on the 
same connection, would send another request.
It is only if no further request from the same client arrives within 20 
seconds, that this thread will give up, close that connection, and 
become available again to process another request.

So I would say that if you do not actually have the kind of client 
interaction where many client requests come in "bursts" (like for 
example returning a page with many image links in it), you could 
probably save yourself a lot of idle waiting threads by reducing this 
parameter to 3 seconds or so.

The second part is the memory usage.
You are getting OOM's with a 2 GB Heap.
2 GB is actually 2048 MegaByte, which is roughly 2048 times 1,000,000 (1 
Million) bytes.  I have customers who use less than that on disk, for 
the database containing their accounts for a full year.
While Java never ceases to amaze me as to how much memory it can use,
there are reasonable applications running within Tomcat under a JVM with 
a Heap of 128 MB, which is 1/16th of 2 GB.
So, while I am not saying that there are not circumstances where a 2 GB 
Heap is justified, it is still a very high number, and maybe you should 
have a look at which application really needs so much space.
Tomcat itself does not.  I also have Tomcats running with a 64 MB Heap, 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message