- Login to your Linux/Unix Server
- Enter the below command to get the JAVA PID running on the server.
ps –ef|grep –i java
From the output take the application JAVA PID.
- Using jstat command with gc option to find out the JVM Heap Memory Usage.
/bin/jstat –gc
S0C – Current survivor space 0 capacity (KB).
S1C – Current survivor space 1 capacity (KB).
S0U – Survivor space 0 utilization (KB).
S1U – Survivor space 1 utilization (KB).
EC – Current eden space capacity (KB).
EU – Eden space utilization (KB).
OC – Current old space capacity (KB).
OU – Old space utilization (KB).
PC – Current permanent space capacity (KB).
PU – Permanent space utilization (KB).
YGC – Number of young generation GC Events.
YGCT – Young generation garbage collection time.
FGC – Number of full GC events.
FGCT – Full garbage collection time.
GCT – Total garbage collection time.
When you add all the ‘utilizations’ i.e OU + EU + S0U + S1U you get the total Heap utilization.
Use Below command if you lazy enough to calculate the above and to get Heap utilisation in one command.
https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js
To understand more about jstat utility .please read the article.
https://javaperformance.wordpress.com/2017/07/05/jstat-jvm-performance-monitoring-tool/
Heap Utilization using jmap
- Enter the below command to get the JAVA PID running on the server.
ps –ef|grep –i java
From the output take the application JAVA PID.
- Using jstat command with gc option to find out the JVM Heap Memory Usage.
/bin/jmap –heap
Calculate the Heap Utilisation by adding the used value of
New Generation (Eden + 1 Survivor Space):
+
concurrent mark-sweep generation:
There are other tools like visualvm, APM tools to get the heap memory usage. If this article found useful please comment and let me know how can i improve.
Read the latest Post on SSL certificate creation and keytool utility,
To understand better about Garbage collection please refer below post.
https://javaperformance.wordpress.com/2017/07/05/garbage-collection-in-java/
To know more about JSTAT tool. Please refer to my below post.
https://javaperformance.wordpress.com/2017/07/05/jstat-jvm-performance-monitoringtool/
Very good article . It provides a good detail about the heap usage
LikeLike
Pingback: JSTAT – JVM Performance Monitoring Tool | Java Tech Support
Hi,
I use below command to get heap usage
jstat -gc 15924 | tail -n 1 | awk ‘{split($0,a,” “); sum=a[3]+a[4]+a[6]+a[8] ; print sum}’
But i get output(scientific number) as below
1.12586e+06
How can i get proper output in KB.
Please let me know.
LikeLike
Hi,
I use below command to get heap usage
jstat -gc 15924 | tail -n 1 | awk ‘{split($0,a,” “); sum=a[3]+a[4]+a[6]+a[8] ; print sum}’
But i get output(scientific number) as below
1.12586e+06
How can i get proper output in KB.
Please let me know.
LikeLike
Please refer to below article to get the memory utilisation in kb
https://javaperformance.wordpress.com/2017/02/07/jvm-memory-structure/
LikeLike
Pingback: JVM | rameshanirud