tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Eggers <its_toas...@yahoo.com>
Subject Re: Local VisualVM connection to Tomcat
Date Thu, 27 Jun 2013 21:03:40 GMT
On 6/27/2013 1:31 PM, honyk wrote:
> Dear All,
>
> I am constantly encountering PermGen errors despite quite high
> PermGen limit (even 512m) and many options set - approx once a week
> under not heavy load.
>
> I am trying to investigate what the app causes this, but I haven't
> succeeded in reproducing it locally yet.
>
> I found several articles about VisualVM (I hope it could help me to
> determine some PermGen issues) and connecting it to the Tomcat.
> Remotely. But I have no clue how can I conect the local VisualVM to
> tomcat that runs on localhost.
>
> Even here it is written:
> http://tomcat.apache.org/tomcat-7.0-doc/monitoring.html
>
> Enabling JMX Remote Note: This configuration is needed only if you
> are going to monitor Tomcat remotely. It is not needed if you are
> going to monitor it locally, using the same user that Tomcat runs
> with.
>
> But there is no further description for that simpler (local) method.
> If it is obvious, sorry, but I am lost here ;-)
>
> Thanks, Jan

It's actually very simple.

1. Start up Tomcat from startup.sh / startup.bat
2. Fire up visualvm
3. The Local node should have Tomcat visible
4. Double-click on the Tomcat element, and you're connected

Getting a first start on where your leaks are is pretty easy as well.

1. Load your web application
2. Run it to generate the leak
3. Unload it from Tomcat using the manager app (or any other method)
4. Do a Find Leaks from the manager app (or garbage collection from
    VisualVM)
5. Do a heap dump
6. In the classes, look for org.apache.catalina.loader.WebappClassLoader
7. Find the instance where the boolean started is false
8. Right-mouse on the instance and search for nearest GC Root
9. Find classes that you wrote and fix

This gets the classLoader leak . . . others can be found by looking for 
application - specific classes.

Hope this helps.

. . . just my two cents
/mde/



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


Mime
View raw message