I am wondering whether is it possible to obtain a Thread Dump during a Full GC.
What am currently doing now,
Obtain the Timestamp / Datestamp during a Full GC
Compare it with the logs and narrow down the request or action that might have triggered it.
I am just wondering whether is it possible to obtain a Thread Dump during Full GC.
You can't obtain any detailed information during a GC. You can now obtain the size of the various heaps via jstat but if your full GC is a stop-the-world- collection it means that everything else has stopped.
Additionally if you could obtain this information, it is unlikely to be what you need to know, it is just one random sample so unless there is only one place which is triggering a gc e.g. a call to System.gc(), or only one place allocating, it won't be so useful.
If you want to know where System.gc() is being triggered you can use instrumentation (or a modified System
class) to do a stack trace where it is explicitly called. I have done this before and found it was the DGC. https://plumbr.eu/blog/garbage-collection/rmi-enforcing-full-gc-to-run-hourly
If you want to know where the highest allocation rate is, I suggest using a memory profiler. That is what the tools is for. It can show you stack traces of where the most/largest objects are being created.