The Young Generation is an area where all new objects are allocated and aged.
When the young generation becomes full, a minor garbage collection is performed which moves referenced objects (survivors) from it.
Minor garbage collection stops in all threads, excepting threads needed by GC, until collection is completed (normaly the collection is fast, but still potential overhead)
Objects that survive long enough are moved to the Old Generation space.
Old Generation objects are collected by a major garbage collection
> jps // List java processes
> jstat -gc // Garbage-collected heap statistics
GC modes:
- Serial GC: Single CPU
- Parallel GC: 2 cores to speed up the process
- Concurrent Mark and Sweep (CMS) GC: reduce the stop-the-world pauses (GC collection occurs concurrently with the application threads.
- Garbage-First (G1) GC.
The horizontal axis represents time and the vertical access represents heap memory used.
- Blue – Allocation rate. The rate in which running application allocates new object on the heap. The steeper it is, the more objects are allocated in the same amount of time.
- Black – A GC event. When garbage is collected during a minor or major GC event, memory is freed from unreachable objects and can be allocated again.
- Green – The baseline trend after GC events. It represents heap utilisation with live (reachable) objects.
Tooling;
Java Mission Control
profiling and diagnostic tools platform for HotSpot JVM. JMC minimizes the performance overhead that's usually an issue with profiling tools.
jcmd utility
used to send diagnostic command requests to the JVM. It is suggested to use the latest utility, jcmd instead of the previous jstack, jinfo, and jmap utilities for enhanced diagnostics and reduced performance overhead.
Java VisualVM
provides a visual interface for viewing detailed information about Java applications while they are running on a Java Virtual Machine.
JConsole utility
based on JMX. The tool provides information about performance and resource consumption of running applications.
jmap utility
obtain memory map information, including a heap histogram, from a Java process, a core file, or a remote debug server
jps utility
lists the instrumented Java HotSpot VMs on the target system. The utility is very useful in environments where the VM is embedded, that is, it is started using the JNI Invocation API rather than the java launcher
jstack utility
obtain Java and native stack information from a Java process (threads dump).
jstat utility
can be used when diagnosing performance issues, especially those related to heap sizing and garbage collection.
jstatd daemon
This tool is a RMI server application that monitors the creation and termination of instrumented JVM and provides an interface to allow clients for remote monitoring
visualgc utility
provides a graphical view of the garbage collection system.
Native tools
Each operating system has native tools and utilities that can be useful for monitoring purposes. For example, the dynamic tracing (DTrace) capability introduced in Oracle Solaris 10 operating system performs advanced monitoring.
Docs:
- https://www.pushtechnology.com/support/kb/understanding-the-java-virtual-machine-heap-for-high-performance-applications/
- https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr025.html
- https://docs.oracle.com/javase/1.5.0/docs/tooldocs/share/jstat.html
No comments:
Post a Comment