Skip to content

Instantly share code, notes, and snippets.

@shlomiv
Last active December 9, 2016 22:27
Show Gist options
  • Save shlomiv/e19372fdbcb00b2986c917bc3c905826 to your computer and use it in GitHub Desktop.
Save shlomiv/e19372fdbcb00b2986c917bc3c905826 to your computer and use it in GitHub Desktop.
Often in an aws emr cluster I will want to check what exactly is going on.. here is a little script that automates installing perf in any cluster node.
#!/bin/sh
# Author: Shlomi Vaknin
# Install perf with java flamegraphs on amazon ec2 instances
# let yarn using be able to sudo
sudo -s
echo "yarn ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
# install required packages
yum -y install git perf cmake
# install flamegrahs and java agent
su - yarn
git clone https://github.com/jrudolph/perf-map-agent.git
git clone https://github.com/brendangregg/FlameGraph.git
# Some initial settings
export FLAMEGRAPH_DIR=~/FlameGraph
export JAVA_HOME=/usr/lib/jvm/java-1.8.0
cd ~/perf-map-agent
cmake .
make
cd ~/perf-map-agent/bin
# fix some silly java bug
sed -i -e 's/\&\& java/\&\& $JAVA_HOME\/bin\/java/g' create-java-perf-map.sh
# Some extra settings
export PERF_FLAME_OPTS="--color=java --width 1900 --title=$HOSTNAME"
echo pwd
echo "Run with"
echo "PERF_RECORD_SECONDS= 15 PERF_RECORD_FREQ= 99 ./perf-java-flames <pid> -a"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment