Last active
April 27, 2021 00:25
-
-
Save aspyker/2a9ecaed1a2c79f1b0d6 to your computer and use it in GitHub Desktop.
running jmxterm from command line to force gc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget http://downloads.sourceforge.net/project/cyclops-group/jmxterm/0.2/jmxterm-0.2-uber.jar | |
a@a:~$ java -jar jmxterm-0.2-uber.jar | |
Welcome to JMX terminal. Type "help" for available commands. | |
?$ open localhost:8076 | |
Connection to localhost:8076 is opened | |
>$ bean java.lang:type=Memory | |
bean is set to java.lang:type=Memory | |
>$ run gc | |
calling operation gc of mbean java.lang:type=Memory | |
operation returns: | |
null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jmap -dump:format=b,file=memory.hprof PIDHERE | |
sometimes | |
sudo jmap -dump:format=b,file=memory.hprof PIDHERE | |
sometimes | |
sudo -u useridofprocess jmap -dump:format=b,file=memory.hprof PIDHERE | |
sometimes requires | |
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope | |
make sure CWD or process is writeable by owner of process |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jstat -gcnew -h 10 PIDHERE 2000 | |
jstat -gcold -h 10 PIDHERE 2000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ugh. I just tried
jmxterm
and it's not very convenient the way you have to interactively type it all or use an expect script. https://gist.github.com/maurorappa/07ce39130cbb1249f8f3746393d66a02#file-monitoring-via-jmx-for-long-periodsMy jar is easier to use: https://github.com/sarnobat/jmx_programmatic/blob/main/src/main/java/PrintMBeans.java