tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 10407] New: - Tomcat Memory Management
Date Tue, 02 Jul 2002 14:18:53 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10407>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10407

Tomcat Memory Management

           Summary: Tomcat Memory Management
           Product: Tomcat 4
           Version: 4.0.3 Final
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: Unknown
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: srikanth_s_india@hotmail.com


Product: 		Java Web Application
Operating system:	Windows NT/2000 server, Linux, FreeBSD
Web Server:		IIS, Apache etc
Application server:	Tomcat 3.2.4 and above
Database server:	MySQL 3.23.49, MS-SQL, Oracle etc
Java Architecture:	JSP (presentation) + Java Bean (Business logic)

	We are currently hosting our web application using Tomcat 4 with IIS 5 
on Windows 2000 server. We have also supplied our product to some of our 
customers who are hosting it on Linux using Tomcat 3.2.4 also. We have been 
facing the following problem for quite some time now. As more and more people 
are visiting and browsing the site, the Java.exe/Tomcat.exe size keeps growing 
and finally we end up with "Out of memory" error. Even if we leave the server 
inactive for hours, the memory doesn't get released and the only option is to 
restart the Tomcat server. We have posted this problem in many forums and in 
the Tomcat bug database also (both 3.* and 4). But we didn't get any solutions 
and also we were told that the problem could lie with our application. 
	So, we decided to conduct a test with Tomcat example JSP pages, so as 
to see whether the memory is getting released properly with them at least. The 
memory.jsp contains the following code and all the example pages used had the 
same code embedded to find out the memory usage.

memory.jsp:
<%
try
{
out.println("<table border=1><tr><td>Total Memory " + Runtime.getRuntime
().totalMemory()/1000 +" KB</td>");
out.println("<td>Memory in Use "+((Runtime.getRuntime().totalMemory()-
Runtime.getRuntime().freeMemory())/1000) +" KB</td>");
out.println("<td>Thread Count " + Thread.activeCount() + "</td></tr></table>");
}
catch(Exception ex)
{
   out.println(ex);
}
%>


Following is the result of the test done on Tomcat 4.03 as standalone server.


Name					Total memory	Used memory	Threads	
memory.jsp				4026		2744		22
examples/jsp/num/numguess.jsp		4026		3464		22
examples/jsp/num/numguess.jsp?guess=	4026		3704		22
examples/jsp/dates/date.jsp		4435		3054		22
examples/jsp/snp/snoop.jspĚ		4435		3374		22
examples/jsp/include/include.jsp	4435		3953		22
examples/jsp/forward/forward.jsp	4599		3850		22
examples/jsp/plugin/plugin.jsp		4599		4176		22
examples/jsp/simpletag/foo.jsp		4730		2712		22
memory.jsp				4730		2977		22
After 30 mins (session timeout)		
memory.jsp				4730		3182		22

	We felt, as in our application, the memory used by Tomcat doesn't get 
released fully even for 
Tomcat example JSP pages. We have repeated the same test many times, restarting 
Tomcat, deleting work folder, clearing browser cache every time. We have even 
tried the same after restarting the machine. The pattern is exactly the same 
barring variations of few bytes here and there. 
		We repeated the same test on Tomcat 3.2.4 and the results were 
similar. Only the figures were different. Then, we decided to conduct the same 
test using JRun 3.1, so as to see whether the memory is getting released 
properly with it at least.

Following is the result of the test done on JRun 3.1 as standalone server.


Name					Total memory	Used memory	Threads	
	
memory.jsp				2859		2451		2
examples/jsp/num/numguess.jsp		3731		2188		4
examples/jsp/num/numguess.jsp?guess=	3731		2339		4
examples/jsp/dates/date.jsp		3870		2150		4
examples/jsp/snp/snoop.jspĚ		3870		2472		4
examples/jsp/include/include.jsp	3870		2010		4
examples/jsp/forward/forward.jsp	3870		2273		4
examples/jsp/plugin/plugin.jsp		3870		2006		4
examples/jsp/simpletag/foo.jsp			
memory.jsp				3870		2063		4
After 30 mins (session timeout)		
memory.jsp				3870		1957		2

	We found out that the memory is getting released periodically and after 
30 minutes of inactivity the memory is totally released and even the thread 
count is back to the original value. We have repeated the same test many times, 
restarting JRun, deleting tmp folder, clearing browser cache every time. We 
have even tried the same after restarting the machine. The pattern is exactly 
the same barring variations of few bytes here and there. 

	Is it a Tomcat bug? If so, how can we get over this problem? Because, 
we need to support our application on Tomcat application server.

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message