« Return to Thread: Re: Blojsom-developers Digest, Vol 4, Issue 15

Re: Blojsom-developers Digest, Vol 4, Issue 15

by Carlos Rodríguez Colino :: Rate this Message:

Reply to Author | View in Thread


    Hi everybody

    According to large loads with Tomcat, I have some experience with it
at work, and I can recommend you the following rules:

    1. Due to the special use of threads in Tomcat, it must always run
quiet under the limit, because otherwise, the performance decrease
quickly. So one instance of Tomcat never must deal with 70% of the max
number of processors (parameter maxProcessors in the Connector tag in
server.xml). That parameter is the max number of simultaneous
connections. The performance is right whenever you don't approach that
limit.

    2. According the number of connections and the amount of data in the
web app, you may need to increase the heap memory of the jvm, because it
always run with default values, and it may not be right for you.
OutOfMemory exceptions appear in these cases. Try increasing JVM  for
parameters -Xms and -Xmx for min and max heap memory (be careful with
your host physical memory!!).

    3. The ulimit value is important because in Unix systems, sockets
are handled as open files... so every http connection is one open file.
That is the reason to increase the ulimit -n value. But, even more
important is to decrease the TIME_WAIT value of the socket. When a TCP
connection is closed, the socket is maintained in this state for a
while, waiting for a lost packet belonging that connection. This state
must exist, but in present networks, the time in this state can  be
really short! And the shorter that timer, the sooner you have a free
open file for a new connection. So try to decrease that value. 5 seconds
may be a right number. Dig in your OS manual to change the value, (ndd
-set /dev/tcp tcp_time_wait_interval 6000 in Solaris,  use sysctl in
Linux, etc...).

    4. Finally, in large loads, the best thing you can do is to balance
your load among more than one tomcat instance. Better than trying to
solve every connection with the same tomcat, set a load balancer in
front, and share the load among several tomcats, in the same or in
different servers. There are a lot of load balancers, both hardware and
software. If you don't maintain a company server, a software solution
may fit you. It accepts all incoming connections and redirect them to
the tomcats behind according some rules (round robin, weights strategy,
etc...). In this way you achieve to divide the load among the number of
instances, so every single instance will run lighter.

    I hope this obvious and general rules will help you! And
congratulations for having large loads! That means you are succeeding!!! ;-)

    See you,

    Carlos




blojsom-developers-request@... escribió:

> Send Blojsom-developers mailing list submissions to
> blojsom-developers@...
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.sourceforge.net/lists/listinfo/blojsom-developers
> or, via email, send a message with subject or body 'help' to
> blojsom-developers-request@...
>
> You can reach the person managing the list at
> blojsom-developers-owner@...
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Blojsom-developers digest..."
>
>
> Today's Topics:
>
>    1. Re: blojsom 2 - Handling large loads (blojsom@...)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 18 Aug 2006 18:59:03 -0300
> From: <blojsom@...>
> Subject: Re: [Blojsom-developers] blojsom 2 - Handling large loads
> To: "Kenneth M. Horan" <khoran@...>,
> blojsom-developers@..., blojsom@...
> Message-ID: <20060818215903.16761.qmail@...>
> Content-Type: text/plain; charset=ISO-8859-1
>
>
>     The output of thread dump is located at tomcat log files.
>
> []s
>
> Claudio
>
> On Fri, 18 Aug 2006 17:27:05 -0400, "Kenneth M. Horan" <KHoran@...> escreveu:
>  
>> Hrm... odd, it seems to be immune to kill -3.  I tossed it the java PID
>> and each time it did nothing.  Is there something else I need to set to
>> use that?  On the bright side it hasn't crashed today, but it is up to
>> 12,500 threads.  I wonder how high it'll go?
>>
>> -----Original Message-----
>> From: blojsom-developers-bounces@...
>> [mailto:blojsom-developers-bounces@...] On Behalf Of
>> blojsom@...
>> Sent: Friday, August 18, 2006 3:49 PM
>> To: blojsom-developers@...
>> Subject: Re: [Blojsom-developers] blojsom 2 - Handling large loads
>>
>>
>>     Do a thread dump: kill -3 PID
>>  
>>     You will see where the thread is blocked, waiting, whatever.
>>     You can use some Thread Dump Analyser to help [1]
>>
>> 1 - https://tda.dev.java.net/
>>
>> []s
>>
>> Claudio
>>
>> On Fri, 18 Aug 2006 15:23:27 -0400, "Kenneth M. Horan"
>> <KHoran@...> escreveu:
>>    
>>> Yup, that's definitely the problem.  I'm leaking threads.  How can I
>>> find out where?  I managed to find one in one of my own classes by
>>>      
>> trial
>>    
>>> and error.  Every time I would run it and do a certain action the
>>>      
>> thread
>>    
>>> count would increase by one and not come back down.  Run it five
>>>      
>> times,
>>    
>>> and the thread count goes up by 5.  Definitely a leak.  Since it only
>>> happened at a certain point it was easy to find though.  It seems that
>>> whenever I create an LDAP connection JAVA creates a new thread, and if
>>> there was an error I was printing it out and returning.  I guess I've
>>> been spoiled by PHP where everything's closed and cleaned up when it
>>> leaves scope, because if I add an LDAP close() before the return the
>>> thread count drops back down.
>>>
>>> Given how fast the thread count keeps climbing (currently approaching
>>> 10,000) I'm confident that I've introduced a leak on some page that's
>>> fairly heavily used.  Dropping the -Xss value does seem to have
>>>      
>> allowed
>>    
>>> JAVA to run more threads, but I didn't even know I was creating new
>>> threads!  So now my problem is, how the heck do I find the leaks?
>>>      
>
>  



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Blojsom-developers mailing list
Blojsom-developers@...
https://lists.sourceforge.net/lists/listinfo/blojsom-developers

 « Return to Thread: Re: Blojsom-developers Digest, Vol 4, Issue 15