Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java Open Source > Apache Tomcat
Apache Tomcat General discussion of the Apache Tomcat servlet container. For discussions specific to the Professional Apache Tomcat book, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Apache Tomcat section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 22nd, 2007, 07:46 AM
Authorized User
Join Date: Apr 2005
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default wierd performance in tomcat/java: help consult


after to test my project in tomcat 5.5.23 and jdk 5 update 12
in network(intranet-only until now with 2 clients) i see that this is fast, after of a some time i can see a wonderful exception
related with java heap exception thrown by the tomcat

after to search in google, i found the solution for windows
(server works with windows XP SP2) related to give some values
for memory ram values to the tomcat5w.exe

i only did the second step

according to this
Click on the Java tab, and enter 128 in the Initial Memory Pool, and 350 or 400 in the Maximum Memory Pool.Leave the other field blank.
so my values are
128 in the Initial Memory Pool
400mb Maximum Memory Pool

the point is that the server is a intel dual core with 3ghz for each , and has DDR2 512 MB of ram

ok, its works, the point is that after to restart the server, the system is fast again,
but then again after of some time the performance go to very slow

if i do ctrl+ alt+ del to see the performance of the pc related with the ram
i taked a picture when start the wierd performance
my ram go to 645MB and swap 46200KB

i thought if i stop to use the system/application(5 minutes),
i can give the chance to the java or tomcat to get and free
some resources

well not the ram go to 640MB and swap to 45276KB

of course if i shutdown my tomcat
i have now these values
RAM 319MB and swap 44564KB

is normal this?,
i dont think so
some important suggestion/advice by our members??

BTW: i am using pool connections related with the db area

thanks so much for advanced

Old September 4th, 2007, 06:05 AM
Friend of Wrox
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post

First thing most of the applications doesn't need more than 256MB. The problem in your case is very clear that there is a memory leak. The points you've to consider to solve this are
1. Make sure that all the connections opened are closed after usage.
2. All the ResultSet objects are closed.
3. All the Statement objects are closed.

We had similar kind of problem with one of our applications [not as you've it was happening after continuous usage for 24 hrs are more than that], and we found that that was the issue. And we did solved it.

Check your connection pool implementation and find out for the undisposed objects.

If you give more details about your architecture and the technologies used i might help you little more.

- Rakesh
Old September 14th, 2007, 02:01 PM
Authorized User
Join Date: Apr 2005
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts

Well, this being old post, the one that I am suggesting may not help you as of now. Some one might be able to use it sometime.

When using Java programs, try to check your applications memory usage using -verbose:gc option. This will start printing the heap usage of the application(in this case Tomcat). Let it run for a day and analyze the heap usage(You have good tools like Samurai to do that). Once you notice that your heap is growing with the time and if you see that Full GC does not reclaim good amount of memory, it is quite possible that you are seeing a leak somewhere. Then you need to check your app/ do a code walk through to check if there could be any memory leaks.

In case you are using Eclipse, I believe there are good number of plugins for profiling the application for any possible memory leaks.

Old September 27th, 2007, 12:29 PM
Registered User
Join Date: Sep 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts

@enjay: please more information on using -verbose:gc option. i'm doing web development in myeclipse with tom-cat webserver 5.x series.

@enjay: also please more information on profiling tools like samurai u mentioned.

@all: just to add to what [u]rakesh_mscit</u> has said. You could put third party jars in commons/lib in tomcat directory but this is only temporary, just like setting max memory for ur web server was a temporary solution, the best bet is to find the culprit (the source of the class leak)

this link would help: http://blogs.sun.com/fkieviet/entry/...e_dreaded_java

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help Desparately - will pay for phone consult Michele_Haywood Access 6 November 8th, 2006 11:39 AM
Performance probelm with tomcat manishwaf Servlets 0 May 29th, 2006 06:47 AM
tomcat and java harshika Apache Tomcat 2 July 21st, 2005 03:09 AM
Apache Tomcat Performance Handbook trailgnome Forum and Wrox.com Feedback 1 October 23rd, 2003 11:26 AM
Java Performance!! Ibn_Aziz JSP Basics 0 September 6th, 2003 08:28 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.