Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What versions of java are slow for gc logging?

I've been told by my company's support team that some versions of java have a significant performance impact when we turn on -verbose:gc. However I can't figure out if this is the case or not.

Was this logging slow(ish) at some point, and when did it stop?

The reason I ask is that there's some hesitation about applying this to a production environment to investigate potential memory leaks (and whether we can stop doing periodic restarts of the system...).

Specifically I'm talking about Java 1.4.2 which I think introduced the argument, and what service pack it applies up to.

like image 709
Stephen Avatar asked Jan 21 '23 14:01

Stephen


1 Answers

I know you asked about the impact of verbose:gc (Amir is correct), but based on the comments I see you are investigating a memory leak.

Is it possible for you to get a histogram of your environment? verbose GC will only show you that there is a memory leak, not where the memory is sitting.

you mention java 1.4.2, is that your current version? If you are using 1.5 or higher you can use

jmap -histo <pid> > file.txt

This will give you a breakdown of all the objects in memory. You will freeze your JVM for a time dependent on the amount of memory in the system. (2GB can freeze for a minute or so on even good hardware) test this on a development system first. I know you don't want to impact your production environment but this is a necessary evil to find the source of the problem. Do a capture right before the periodic restart to lesson your impact.

like image 154
Sean Avatar answered Jan 26 '23 00:01

Sean