Is there a Linux Command Line that shows JVM Code Cache usage at the moment?

970 views Asked by At

We are receiving some error in one of our Java application that is running on Tomcat 7. I am looking for a command line that can show us the value of Code Cache at any moment. Is there any command like jstat that can print out the Code Cache value?

Thank you!

2

There are 2 answers

0
Sam On

I was able to use JMXProxy and get the result using the command below. I am posting it, in case somebody else needs to get used Code Cache for Tomcat.

curl -u '<tomcat jmx-user>:<tomcat-jmx-user-password>' --url "http://localhost:8080/manager/jmxproxy/?qry=*:type=MemoryPool,name=Code%20Cache" | grep -o -P '{committed=[0-9]*, init=[0-9]*, max=[0-9]*, used=[0-9]*}'

0
Juraj Martinka On

You can get detailed info from jcmd <PID> Compiler.codecache (assuming JDK, not JRE; may also depend on JDK version)

There's even a much more verbose jcmd <PID> Compiler.codelist.