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
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- | |
Licensed to the Apache Software Foundation (ASF) under one or more | |
contributor license agreements. See the NOTICE file distributed with | |
this work for additional information regarding copyright ownership. | |
The ASF licenses this file to You under the Apache License, Version 2.0 | |
(the "License"); you may not use this file except in compliance with | |
the License. You may obtain a copy of the License at |
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
// Find PID | |
[user@host ~]$ ps -ef | grep app-name | |
user 14276 184778 1 11:46 pts/3 00:00:28 /host/setups/jdk1.8.0_191/bin/java -jar app-name-0.0.1-SNAPSHOT.jar | |
------------------------------- | |
// Find the list of port used for the PID | |
[user@host ~]$ netstat -lnp | grep 14422 | |
(Not all processes could be identified, non-owned process info | |
will not be shown, you would have to be root to see it all.) |
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
#!/bin/bash | |
pid=$1 | |
appName=$2 | |
timestamp=`date +%FT%H-%M-%S` | |
pidstat -w -d -t -p $pid -h 5 > /var/tmp/$appName-$timestamp.out | |
#bash pidstat.sh 22292 app-name & |
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
#!/bin/bash | |
pid=$1 | |
nohup top -Hb -p $pid > /var/tmp/top-$pid-`date +%FT%H-%M-%S`.log & |
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
#!/bin/bash | |
nohup iostat -t 5 > /var/log/iostat-logs/iostat-`date +%FT%H-%M-%S`.log & | |
nohup top -u hdpusr -b > /var/log/top-logs/top-`date +%FT%H-%M-%S`.log & | |
nohup vmstat -t 5 > /var/log/vmstat-logs/vmstat-`date +%FT%H-%M-%S`.log & |
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
#Single file. Works well with double digits e.g. %Cpu(s): 16.5 us, 81.7 id. You may have to change -f2,10 to -f3,11 or something related | |
#!/bin/bash | |
inFile=$1 | |
grep 'Cpu(s)' $inFile | cut -d ' ' -f2,10 | sed '/[a-z]/d' | sort -t',' -k1nr,1 | |
# Calling the script | |
# bash top-cpu-usage-analysis.sh /var/tmp/cpu-stats-2020-10-01T18-16-58.log |
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
#!/bin/bash | |
pid=$1 | |
appName=$2 | |
fileName=$3 | |
delay=$4 | |
duration=$5 | |
timestamp=`date +%FT%H-%M-%S` | |
$JAVA_HOME/bin/jcmd $pid VM.unlock_commercial_features |
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
import java.nio.ByteBuffer; | |
import java.sql.Date; | |
import java.sql.Timestamp; | |
import java.time.Instant; | |
import java.time.LocalDateTime; | |
import java.time.ZoneId; | |
import java.time.format.DateTimeFormatter; | |
public class ByteBufferUsage { |
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
#!/bin/bash | |
timestamp=`date +%FT%H-%M-%S` | |
sleepMillis=10 | |
while true | |
do | |
top -b -o +%CPU | head -n 17 >> /var/tmp/cpu-stats-$timestamp.log | |
sleep $sleepMillis | |
done |
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
[user@abnormalhost ~]$ $JAVA_HOME/bin/jcmd 56135 JFR.start name=app_name delay=1s duration=2m filename=/var/tmp/app_name.jfr | |
56135: | |
Java Flight Recorder not enabled. | |
Use VM.unlock_commercial_features to enable. | |
[user@abnormalhost ~]$ $JAVA_HOME/bin/jcmd 56135 VM.unlock_commercial_features | |
56135: | |
Commercial Features now unlocked. |
NewerOlder