Вячеслав Смирнов
Эксперт по тестированию,
Райффайзенбанк
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-b04)
OpenJDK 64-Bit Server VM (build 25.212-b04, mixed mode)
InfluxDB, Telegraf, Jolokia
SJK (Swith Java Knife)
JFR (Java Fligth Recorder, на тестовом стенде)
InfluxDB, Telegraf, Jolokia
SJK (Swith Java Knife)
> java -jar sjk.jar --help hh
Usage: hh [options]
-p, --pid
JVM process PID
[Stack Capture] Dumps stack traces to file for further processing
Usage: stcap [options]
-p, --pid
JVM process PID
-s, --socket
Socket address for JMX port (host:port)
--user
User for JMX authentication (only for socket connection)
> sudo -u user java -jar sjk.jar hh --pid $PID
> sudo -u user java -jar sjk.jar stcap --pid $PID
> JAVA=/opt/jdk1.8.0_201/bin/java
> yum install java-1.8.0-openjdk-devel.x86_64
> JAVA=`ls -l /etc/alternatives/java | \ sed 's|.* -> ||' | sed 's|/jre||'`
> sudo -u user $JAVA -jar sjk.jar hh --pid $PID
> sudo -u user $JAVA -jar sjk.jar stcap --pid $PID
> pgrep -fa "java"
9044 /usr/lib/jvm/java-1.11.0-openjdk-amd64/bin/java -Dmaven.multiModuleProjectDirectory=/home/user/Project/github.com/jvm.profiling.automation -Dmaven.home=/snap/intellij-idea-community/169/plugins/maven/lib/maven3 -Dclassworlds.conf=/snap/intellij-idea-community/169/plugins/maven/lib/maven3/bin/m2.conf
9077 java -Xms256M -Xmx1024M -jar ApacheJMeter-5.1.1.jar -d /home/user/Project/github.com/jvm.profiling.automation/target/jmeter
> pgrep -f "^java .*-jar ApacheJMeter" -u user
9077
> java -jar sjk.jar jps
9044 org.codehaus.classworlds.Launcher -Didea.version2019.2.1 com.lazerycode.jmeter:jmeter-maven-plugin:2.8.6:jmeter -P Core
9077 ApacheJMeter-5.1.1.jar -d /home/user/Project/github.com/jvm.profiling.automation/target/jmeter -j /home/user/Project/github.com/jvm.profiling.automation/target/jmeter/logs/Core.jmx.log -l /home/user/Project/github.com/jvm.profiling.automation/target/jmeter/results/Core-2019-09-06_12-10-39.csv -n -t /home/x1337/Project/github.com/jvm.profiling.automation/target/jmeter/testFiles/Core.jmx -L ERROR
9500 sjk.jar jps
> java -jar sjk.jar jps \
> --filter-description "ApacheJMeter*" \
> --process-details PID
9077
> sudo -u user java -jar sjk.jar jps \
> --filter-description "ApacheJMeter*" \
> --process-details PID
9077
> sudo -u user $JAVA -jar sjk.jar hh --pid $PID
# Instances Bytes Type
1: 30000 3330000 [C
2: 40000 220000 java.lang.String
3: 7000 111111 java.lang.Class
4: 15000 50000 ru.raiff.util.test.Map$Node
Total 92000 3711111
Type | g1 | g2 | g3 | Count | Bytes |
---|---|---|---|---|---|
char[] | - | - | - | 30000 | 3330000 |
java.lang.String | java | lang | - | 40000 | 220000 |
java.lang.Class | java | lang | - | 7000 | 111111 |
ru.raiff.util.test.Map$Node | ru | raiff | util | 15000 | 50000 |
Total | - | - | - | 92000 | 3711111 |
Type | g1 | g2 | g3 | Count | Bytes |
---|---|---|---|---|---|
char[] | - | - | - | 30000 | 3330000 |
java.lang.String | java | lang | - | 40000 | 220000 |
java.lang.Class | java | lang | - | 7000 | 111111 |
ru.raiff.util.test.Map$Node | ru | raiff | util | 15000 | 50000 |
Type | g1 | g2 | g3 | Count | Bytes | %C | %B |
---|---|---|---|---|---|---|---|
char[] | - | - | - | 30000 | 3330000 | 32.6 | 89.7 |
java.lang.String | java | lang | - | 40000 | 220000 | 43.4 | 5.9 |
java.lang.Class | java | lang | - | 7000 | 111111 | 7.6 | 2.9 |
ru.raiff.util.test.Map$Node | ru | raiff | util | 15000 | 50000 | 16.3 | 1.3 |
while [ -n $PID ]
do
sudo -u user $java -jar sjk.jar hh --live --pid $PID | \
awk -v app=JMeter -v n=30 -f sjk.hh.2.influx.awk | \
curl -i -XPOST http://influxHost:8086/write?db=sjk \
--data-binary @-
sleep 30.0
PID=`pgrep -f "^java .*-jar ApacheJMeter"`
done
[[inputs.exec]]
commands = [
"/opt/sjk/sjk.hh.sh"
]
timeout = "30s"
interval = "60s"
data_format = "influx"