jvm memory profiling tools https://www.baeldung.com/java-profilers
- swapon --summary
- vmstat 1
- free -m
- cat /proc/meminfo
- sar -r (memory report)
- sar -S (swap report)
- ps -eo comm,etime,user | grep java
- pstack or gstack for CPU debugging (ie Apache HTTPD high CPU on RHEL - Red Hat Customer Portal)
- top -b
- jstack
standard JVM monitoring tools https://docs.oracle.com/javase/8/docs/technotes/tools/unix/s9-monitoring-tools.html#sthref282
standard JVM debugging tools https://docs.oracle.com/javase/8/docs/technotes/tools/unix/s11-troubleshooting_tools.html#sthref327
# total_java_processes_size
env PID=$(cat PID_FILE) ps -ylC java --sort:rss | grep $PID | awk '{ sum += $9 } END { print sum }'
...
# total_java_processes_count
env PID=$(cat PID_FILE) ps -ylC java --sort:rss | grep $PID | wc -l
To get the PID, you can use tools like jps -v