Garbage Collection low-impact monitoring
Pas
pasthelod at gmail.com
Sun Mar 17 20:35:41 PDT 2013
Hello,
On Mon, Mar 18, 2013 at 2:54 AM, Ruben Badaró <ruben.badaro at gmail.com> wrote:
> Hi,
>
> I'm looking at ways of monitoring garbage collection statistics. My goals
> are to have close to no impact to the running process and the most detail
> possible. For that, I would like to avoid any type of instrumentation as I
> want this running constantly in production.
>
> An easy way is to parse gc logs but I remember someone reading the VM
> structs for the garbage collection counters somewhere.
You might be thinking about the hsperfdata_<user> directory, which is
also used by jstat in a very similar way to what you've described.
(There is a descriptor file for each JVM instance, which basically is
a layout map for the VM structures you're looking for, and jstat just
mmap-s the relevant memory blocks and reads from them.)
> Do you guys have any examples of how to do this? I looked at the
> Serviceability Agent but apparently it pauses the the running process while
> inspecting.
Last time I've used it, I've found no pause times for simply using
jstat -gc -gccause on a local JVM. (Or more precisely, no impact of a
1 ms polling interval.)
> I was also considering (because my concern here is exclusively
> when running Linux) to use the /proc/pid/maps memory mapped files and read
> them in read-only mode from my monitoring process.
> Does something like this already exist or is there a fundamental reason of
> why it wouldn't work?
Well, to absolutely catch all GC events you have to chose a polling
interval shorter than the shortest minor GCs, which might not be
efficient compared to just consuming the verbose GC log. (But, to my
knowledge the GC log is written synchronously, which might be a
problem if there is not enough free memory for Linux's fscache to work
its magic.)
>
> Thanks
> Ruben
--
Pas
More information about the hotspot-gc-use
mailing list