What I wanted to do was to use jcmd to get the jfr file on the web application server and check the heap usage status on jmc on my development PC (Windows).
In order to record heap usage data in the jfr file, it is necessary to modify the profile and pass it as the settings parameter of jcmd. (It took me a long time to get there, probably because I wasn't looking for it.)
Two types of profiles are stored below.
$ cd [JDK_PATH]/jre/lib/jfr
$ ll
-rw-r--r--1 root root 20109 October 6 22:55 default.jfc
-rw-r--r--1 root root 20065 October 6 22:55 profile.jfc
Copy profile.jfc (myProfile.jfc) and enable the part of the heap that seems to be related to data recording. I'm not sure if this is correct because I couldn't find a reference around here. (But it works.)
<!--From false to true around line 127-->
<flag name="heap-statistics-enabled" label="Heap Statistics">true</flag>
<!--From false to true around line 268-->
<event path="vm/gc/detailed/object_count">
<setting name="enabled" control="heap-statistics-enabled">true</setting>
<setting name="period">everyChunk</setting>
</event>
I will omit the detailed information, but the point is to specify the profile created earlier with the settings parameter.
jcmd [PID] JFR.start name=MyJfrRec settings=myProfile maxsize=100mb dumponexit=true filename=/tmp/myJfrRec.jfr
Check the recording status
jcmd [PID] JFR.check
Dump of recorded information
jcmd [PID] JFR.dump name=MyJfrRec filename=/tmp/mytasrec.jfr
End of recording
jcmd [PID] JFR.stop name=MyJfrRec
After that, if you load the acquired jfr file into jmc, the graph will come out with a good feeling.
[Site that I referred to] http://waysaku.hatenablog.com/entry/2014/07/22/005304 https://blogs.oracle.com/poonam/clarifying-some-confusion-around-java-flight-recordings
We are looking for engineers. I hope you can see this as well. https://www.nittsu-infosys.com/recruit/2019/index.html
Recommended Posts