tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From João Augusto Charnet <joao.char...@sfw.com.br>
Subject Re: Tomcat eats 100% CPU !
Date Tue, 06 May 2003 18:17:49 GMT
What is the deal in re-using StringBuffer instances ??
Is it better to always instaciate a new StringBuffer ???
Why ???

John

Tam, Michael wrote:

>it depends how you use the stringbuffer.  It is ok if stringbuffer instance
>didn't get re-use.
>
>-----Original Message-----
>From: Mark Pease [mailto:mpease@chartermi.net]
>Sent: Tuesday, May 06, 2003 7:08 AM
>To: Tomcat Users List
>Subject: Re: Tomcat eats 100% CPU !
>
>
>If you use a lot of StringBuffers in your Java code, don't go to JDK 1.4.1 -
>it will start your memory problems all over again!
>
>----- Original Message -----
>From: <yogi-ml@darkmag.net>
>To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
>Sent: Tuesday, May 06, 2003 10:01 AM
>Subject: RE: Tomcat eats 100% CPU !
>
>
>  
>
>>Thx a lot, it works great. That's was indeed the problem, i've set the
>>memory up to 196m and it's as fast as on my development station !
>>
>>Gonna upgrade to TC 4.1 & JDK 1.4.1 soon..
>>
>>
>>    
>>
>>>In the hope this might help ...
>>>
>>>I used to have this problem with tc4.0... and jdk1.4.0
>>>Someone else on this group told me the problem went away when they went
>>>to jdk1.4.1 and tc4.1...
>>>I tried that and it made the difference !
>>>Don't know if you can get a later jvm/tomcat on the server though ??
>>>
>>>The problem seemed to be associated with garbage collection - the jvm
>>>would try to gc then go into a flat spin and not recover.
>>>
>>>It might be that upping the resources with -Xms and -Xmx would help.
>>>And by the way these are controlled by
>>>1) the CATALINA_OPTS environment variable (perhaps TOMCAT_OPTS for
>>>4.0?) for the batch file
>>>but by
>>>2) Registry keys for the NT service ...
>>>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Apache Tomcat
>>>4.1\Parameters,
>>>then JVM Option Number 0 etc (and don't forget JVMOptionCount) for
>>>tc4.1,
>>>can't remember what name the tc4.0 service is called, but you can
>>>probably hunt it down :)
>>>
>>>I can be more specific if you think this may help ...
>>>
>>>Christopher
>>>
>>>      
>>>
>>>>-----Original Message-----
>>>>From: yogi-ml@darkmag.net [mailto:yogi-ml@darkmag.net]
>>>>Sent: 06 May 2003 12:04
>>>>To: Tomcat Users List
>>>>Cc: Tomcat Users List
>>>>Subject: Re: Tomcat eats 100% CPU !
>>>>
>>>>
>>>>I forgot to say i'm launching the server's tomcat with a
>>>>batch file, and that's not consuming CPU only the first time
>>>>when compiling JSP - yes it does, but it also gets slow randomly :/
>>>>
>>>>Note also that the CPU load comes back to a normal ratio
>>>>after 25 or 30 seconds, in other word the behavior is normal
>>>>except it's anormally slow.
>>>>
>>>>Thx anyway, i'm still searching..
>>>>
>>>>
>>>>        
>>>>
>>>>>I've come across this problem before.
>>>>>
>>>>>Our application used to exhibit this behavior  when running
>>>>>          
>>>>>
>>>>tc as an
>>>>        
>>>>
>>>>>NT service. All would be fine until the server hit some
>>>>>          
>>>>>
>>>>heavy load and
>>>>        
>>>>
>>>>>the CPU would shoot to 100% and never come back .
>>>>>
>>>>>When running tc from the batch file instead of as a service, the
>>>>>problem went away.
>>>>>
>>>>>Unfortunately I never got round to working out why this was
>>>>>          
>>>>>
>>>>happening.
>>>>        
>>>>
>>>>>The less time I spend on a windows machine the better!! I get a
>>>>>headache....
>>>>>
>>>>>I know a couple of our customers use a third party tool to create a
>>>>>service instead of the one bundled with tc and this seemed
>>>>>          
>>>>>
>>>>to work for
>>>>        
>>>>
>>>>>them.
>>>>>
>>>>>Steven Shand.
>>>>>
>>>>>
>>>>>On Tuesday, May 6, 2003, at 11:12  am, yogi-ml@darkmag.net wrote:
>>>>>
>>>>>          
>>>>>
>>>>>>Hail,
>>>>>>
>>>>>>First of all, hello to everybody, i just subscribed to this ML, i
>>>>>>guess it'll be more practical than Sun's forums to help, be helped
>>>>>>and exchange experiences/issues.
>>>>>>
>>>>>>To introduce myself, i'm a 23 years old french student in computer
>>>>>>science, and i actually work for my training course on a J2EE web
>>>>>>application (with Tomcat :). I'm using PHP for 3 years, and i'm
>>>>>>fairly newbie with JSP/Servlets as it's my first "real"
>>>>>>            
>>>>>>
>>>>project with
>>>>        
>>>>
>>>>>>it !
>>>>>>
>>>>>>Now you're aware of who am i, let's go !
>>>>>>
>>>>>>I coded a webapp under Tomcat 4.1.18 with J2SE 1.4.1-1 and J2EE
>>>>>>1.3.1, Oracle 9i, the whole on a PIV 2.4 Ghz / 512 Mb with
>>>>>>            
>>>>>>
>>>>Windows XP
>>>>        
>>>>
>>>>>>SP1.
>>>>>>
>>>>>>I use Javamail/JAF, JSP pages, servlets, taglibs ("simple" tags or
>>>>>>body tags - 1.2 specs) and a datasource (an Oracle connection pool
>>>>>>(DBCP), with the patched classes12.jar for both Oracle 8i
>>>>>>            
>>>>>>
>>>>& 9i). The
>>>>        
>>>>
>>>>>>webapp is pretty
>>>>>>heavy (lots of SQL requests, dozen of tags + an
>>>>>>            
>>>>>>
>>>>authentification layer
>>>>        
>>>>
>>>>>>w/
>>>>>>sessions, and so more) but everything runs perfectly, it takes
>>>>>>approximately between 0.5 and 1 second to process and
>>>>>>            
>>>>>>
>>>>generate the HTML
>>>>        
>>>>
>>>>>>pages.
>>>>>>
>>>>>>As my webapp is finished, i'm trying to deploy it on my company's
>>>>>>server. It's a DELL server, with 512 Mb RAM running with
>>>>>>            
>>>>>>
>>>>Windows NT 4
>>>>        
>>>>
>>>>>>(don't know
>>>>>>the SP - i may check if necessary). I don't really know
>>>>>>            
>>>>>>
>>>>what kind of
>>>>        
>>>>
>>>>>>CPU
>>>>>>is it, but it's a huge monster. It's running Tomcat 4.0.3
>>>>>>            
>>>>>>
>>>>LE with J2SE
>>>>        
>>>>
>>>>>>1.4.0, and an Oracle 8.1.7.
>>>>>>
>>>>>>My problem is that sometime it's blazzing fast, sometime it's
>>>>>>horribly slow.. I mean, for a same page, it may be
>>>>>>            
>>>>>>
>>>>processed in less
>>>>        
>>>>
>>>>>>than 0.3 sec as it may be processed in 25 or 30 seconds..
>>>>>>            
>>>>>>
>>>>In the last
>>>>        
>>>>
>>>>>>case, the java.exe process (remember, Tomcat LE) takes 99% of the
>>>>>>CPU, i really don't know what it's computing and what's
>>>>>>            
>>>>>>
>>>>happening..
>>>>        
>>>>
>>>>>>There's no timeout,
>>>>>>the pages is entirely generated, but it's slow !
>>>>>>
>>>>>>In all the cases, while processing a servlet or jsp script, the
>>>>>>Oracle process don't consume lots of CPU (3 or 4%, not
>>>>>>            
>>>>>>
>>>>more), i don't
>>>>        
>>>>
>>>>>>think the problem comes from there.
>>>>>>
>>>>>>I tried J-Sprint to profile my webapp, but it didn't help me much.
>>>>>>
>>>>>>I really don't know what to do right now, the webapp should be
>>>>>>released for 2 days, everything is ok except that..
>>>>>>
>>>>>>Any help/tip/advice/suggestion or eventually shotgun would
>>>>>>            
>>>>>>
>>>>be GREATLY
>>>>        
>>>>
>>>>>>appreciated !
>>>>>>
>>>>>>Thx a lot,
>>>>>>
>>>>>>YoGi
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>---------------------------------------------------------------------
>>>>        
>>>>
>>>>>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>>>>>For additional commands, e-mail:
>>>>>>            
>>>>>>
>>>>tomcat-user-help@jakarta.apache.org
>>>>        
>>>>
>>>>>
>>>>>          
>>>>>
>>>>---------------------------------------------------------------------
>>>>        
>>>>
>>>>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>>>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>>>
>>>>
>>>>        
>>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>>
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>  
>

-- 

<http://www.sfw.com.br>

João Augusto Charnet
Computer Engineer - e-Softcomex Team

Phone/Fax: 55 19 3739-9200
E-mail: joao.charnet@sfw.com.br <mailto:joao.charnet@sfw.com.br>
R. Conceicao, 233 - Cj, 609 - Centro
13010-050 - Campinas - SP - Brazil



Mime
View raw message