tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <ext-narsi.re...@nokia.com>
Subject RE: How to increase the tomcat heap memory
Date Wed, 31 Dec 2008 06:46:36 GMT


HI Leon 

Thanks for ur reply to my query , 

>or, on windows, in catalina.bat
>
>JAVA_OPTS="-mx256M -ms256M -XX:MaxPermSize=256m"
>


I added the above in my catalina.bat as JAVA_OPTS="-mx1024M -ms1024M
-XX:MaxPermSize=256m , I got some improovement 
As u know that iam running 30 threads with requests in jmeter ,
previosly in monitor results I used to see the server state as  dead
state, Now im getting healthy state atleast ,but some of the requests
are still failing , I mean failed requests are showing Out of memory
error , and test is failing in short time its not runing long time ,
when I saw in  tomcat status using
http://localhost:8080/manager/status
Im still getting the 64m memory ,so where can I check for the correct
memory ,
is there any more suggestion to get rid of this Out of memory  error ,


Coming to technology im using  normal jdbc with datasource connection ,
and here is my context.xml configuration 


 <Resource name="jdbc/TestDB" auth="Container"
type="javax.sql.DataSource"
               maxActive="1000" maxIdle="300" maxWait="-1"
               username="root" password="satyam"
driverClassName="com.mysql.jdbc.Driver"
 
url="jdbc:mysql://localhost:3306/extravert?autoReconnect=true"/>


And thread setting configuaration in server.xml is like this 

      <Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"  
	   redirectPort="8443"  maxHttpHeaderSize="8192"
maxProcessors="150" 
	   maxThreads="150" minSpareThreads="25" maxSpareThreads="75" 
	   enableLookups="false" acceptCount="150"
disableUploadTimeout="true" />


And here is my failed request error output from jmeter 



<html><head><title>Apache Tomcat/6.0.18 - Error
report</title><style><!--H1
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D7
6;font-size:22px;} H2
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D7
6;font-size:16px;} H3
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D7
6;font-size:14px;} BODY
{font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;
} B
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D7
6;} P
{font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-s
ize:12px;}A {color : black;}A.name {color : black;}HR {color :
#525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><HR
size="1" noshade="noshade"><p><b>type</b> Exception
report</p><p><b>message</b> <u></u></p><p><b>description</b>
<u>The
server encountered an internal error () that prevented it from
fulfilling this request.</u></p><p><b>exception</b>
<pre>javax.servlet.ServletException: Servlet execution threw an
exception
</pre></p><p><b>root cause</b> <pre>java.lang.OutOfMemoryError:
Java
heap space
	java.util.Arrays.copyOf(Arrays.java:2882)
	
java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.jav
a:100)
	
java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:390)
	java.lang.StringBuilder.append(StringBuilder.java:119)
	
com.nokia.buddyradar.parser.LocationXMLCreator.xmlToByteArray(LocationXM
LCreator.java:189)
	
com.nokia.buddyradar.webapi.WebApiServlet.convertXml(WebApiServlet.java:
154)
	
com.nokia.buddyradar.webapi.WebApiServlet.doGet(WebApiServlet.java:109)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
</pre></p><p><b>note</b> <u>The full stack trace of the
root cause is
available in the Apache Tomcat/6.0.18 logs.</u></p><HR size="1"
noshade="noshade"><h3>Apache Tomcat/6.0.18</h3></body></html>



Is there any wrong in my settings , or any suggestions , can somebody
help me pls ??????

Regards 

Narsi



>-----Original Message-----
>From: ext Leon Rosenberg [mailto:rosenberg.leon@googlemail.com] 
>Sent: Tuesday, December 30, 2008 4:22 PM
>To: Tomcat Users List
>Subject: Re: How to increase the tomcat heap memory
>
>add following to your catalina.sh
>
>export JAVA_OPTS="-mx256M -ms256M -XX:MaxPermSize=256m"
>
>or, on windows, in catalina.bat
>
>JAVA_OPTS="-mx256M -ms256M -XX:MaxPermSize=256m"
>
>The values are only an example, the PermSize is optional if 
>you have many classes/jsps.
>
>regards
>Leon
>
>
>On Tue, Dec 30, 2008 at 11:37 AM,  <ext-narsi.reddy@nokia.com> wrote:
>>
>>
>> Hi
>>
>>              Basically  im running  jmeter  with 30 threads with 3 
>> requests with tomcat 6.0.18 , but tomcat is giving the Out of memory 
>> error ,  I want to increase Heap memory of tomcat , I tried  somany 
>> ways  but it did not worked for me , it is  almost  1 week  for me ,
>>
>> can somebody  pls help me how to increase the heap memory of tomcat
>> 6.0.18 , and how can I check whether the memory is incresed 
>or not ???
>>
>>
>> Here is sever error  code ,
>>
>> Dec 30, 2008 3:54:18 PM org.apache.catalina.core.StandardWrapperValve
>> invoke
>> SEVERE: Servlet.service() for servlet WebAPI threw exception
>> java.lang.OutOfMemoryError: Java heap space
>>        at java.util.Arrays.copyOf(Arrays.java:2882)
>>        at
>> 
>java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.j
>> av
>> a:100)
>>        at
>> 
>java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:390)
>>        at java.lang.StringBuilder.append(StringBuilder.java:119)
>>        at
>> 
>com.nokia.buddyradar.parser.LocationXMLCreator.xmlToByteArray(Location
>> XM
>> LCreator.java:189)
>>        at
>> 
>com.nokia.buddyradar.webapi.WebApiServlet.convertXml(WebApiServ
>let.java:
>> 154)
>>        at
>> 
>com.nokia.buddyradar.webapi.WebApiServlet.doGet(WebApiServlet.java:109)
>>        at 
>javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
>>        at 
>javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>>        at
>> 
>org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli
>> ca
>> tionFilterChain.java:290)
>>        at
>> 
>org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi
>> lt
>> erChain.java:206)
>>        at
>> 
>org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVa
>> lv
>> e.java:233)
>>        at
>> 
>org.apache.catalina.core.StandardContextValve.invoke(StandardContextVa
>> lv
>> e.java:191)
>>        at
>> 
>org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.ja
>> va
>> :128)
>>        at
>> 
>org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.ja
>> va
>> :102)
>>        at
>> 
>org.apache.catalina.core.StandardEngineValve.invoke(StandardEng
>ineValve.
>> java:109)
>>        at
>> 
>org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java
>> :2
>> 86)
>>        at
>> 
>org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor
>> .j
>> ava:857)
>>        at
>> 
>org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.pro
>> ce
>> ss(Http11AprProtocol.java:565)
>>        at
>> 
>org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.j
>ava:1509)
>>        at java.lang.Thread.run(Thread.java:619)
>> Dec 30, 2008 3:54:18 PM org.apache.catalina.core.StandardWrapperValve
>> invoke
>> SEVERE: Servlet.service() for servlet WebAPI threw exception
>> java.lang.OutOfMemoryError: Java heap space
>>        at java.util.Arrays.copyOf(Arrays.java:2786)
>>        at
>> java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:94)
>>        at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202)
>>        at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:263)
>>        at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:106)
>>        at 
>java.io.OutputStreamWriter.write(OutputStreamWriter.java:190)
>>        at java.io.BufferedWriter.flushBuffer(BufferedWriter.java:111)
>>        at java.io.BufferedWriter.write(BufferedWriter.java:212)
>>        at java.io.Writer.write(Writer.java:140)
>>        at
>> 
>org.dom4j.io.XMLWriter.writeEscapeAttributeEntities(XMLWriter.j
>ava:1720)
>>        at org.dom4j.io.XMLWriter.writeAttributes(XMLWriter.java:1489)
>>        at org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:937)
>>        at org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301)
>>        at
>> org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1086)
>>        at org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:954)
>>        at org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301)
>>        at org.dom4j.io.XMLWriter.write(XMLWriter.java:344)
>>        at
>> 
>com.nokia.buddyradar.parser.LocationXMLCreator.xmlToByteArray(Location
>> XM
>> LCreator.java:186)
>>        at
>> 
>com.nokia.buddyradar.webapi.WebApiServlet.convertXml(WebApiServ
>let.java:
>> 154)
>>        at
>> 
>com.nokia.buddyradar.webapi.WebApiServlet.doGet(WebApiServlet.java:109)
>>        at 
>javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
>>        at 
>javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>>        at
>> 
>org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli
>> ca
>> tionFilterChain.java:290)
>>        at
>> 
>org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi
>> lt
>> erChain.java:206)
>>        at
>> 
>org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVa
>> lv
>> e.java:233)
>>        at
>> 
>org.apache.catalina.core.StandardContextValve.invoke(StandardContextVa
>> lv
>> e.java:191)
>>        at
>> 
>org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.ja
>> va
>> :128)
>>        at
>> 
>org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.ja
>> va
>> :102)
>>        at
>> 
>org.apache.catalina.core.StandardEngineValve.invoke(StandardEng
>ineValve.
>> java:109)
>>        at
>> 
>org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java
>> :2
>> 86)
>>        at
>> 
>org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor
>> .j
>> ava:857)
>>        at
>> 
>org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.pro
>> ce
>> ss(Http11AprProtocol.java:565)
>>  im in users block of readxml
>> datasource connection
>> jdbc:mysql://localhost:3306/extravert?autoReconnect=true,
>> UserName=root@localhost, MySQL-AB JDBC Driver datasource connection 
>> jdbc:mysql://localhost:3306/extravert?autoReconnect=true,
>> UserName=root@localhost, MySQL-AB JDBC Driver  inserted in 
>to location 
>> tablejdbc:mysql://localhost:3306/extravert?autoReconnect=true,
>> UserName=root@localhost, MySQL-AB JDBC Driver datasource connection 
>> jdbc:mysql://localhost:3306/extravert?autoReconnect=true,
>> UserName=root@localhost, MySQL-AB JDBC Driver
>>
>>
>>
>> Thanks and Regards
>>
>> Narsi Reddy CH
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message