Question

We have Tomcat 7(0.0.47) in test environment and I decided to take heap dump from it to see if everything is OK with our memory.

It contains three apps - one is jersey+spring rest web app, another is web app with almost no incoming http requests, but quartz with heavy business logic and the third one is lightweight web app that supports some jmx points to work with some classes.

In visualvm I see some values that scare me. I wonder if its OK or something went wrong?

  1. WebappClassLoader for jersey rest app has retained size 25 364 571, while class loaders for other two apps are significantly smaller - about 5KK and 8KK. Is it OK?

  2. Summary tab shows me that i had 337 classloader and 3376 GC roots? Isn't that too much? and Total instances: 1 573 037

  3. I also tried to take dump without :live option a bit later (after half an hour) and i saw on a summary that i have almost same amount of classloaders (346) and GC roots (3329). But the size of "live and dead" dump is much bigger that size of "live" dump - 926Mb vs 390Mb. Is it OK or do I have some memory leaks?

  4. I looked at big classloader dump and I see that the biggest retained size in it has HashMap resourceEntries. What does this hashmap represent? Should I look through unused external libraries and exclude them to reduce this size or is it OK?

Sorry for some kind of dumb questions, i'm a bit newbie at memory optimization

Était-ce utile?

La solution

  1. How much memory do you have allocated to your servers?
  2. What are your GC flags?

Has your production application fallen over with an OutOfMemoryException for either PermGen or Heap? If not, and your servers have been up for > 1 week, then no, you most likely do not have an issue.

Edit: as commented below, some GC tuning might be in order:

JAVA_OPTS="$JAVA_OPTS -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled"
JAVA_OPTS="$JAVA_OPTS -XX:+AggressiveOpts -XX:+UseFastAccessorMethods"
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top