Last active
November 9, 2021 05:56
-
-
Save ChrisCinelli/f5c659d5a877beb5723eea5e81d1534b to your computer and use it in GitHub Desktop.
Flame graphs on AWS on a ELB
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
# Flame graph on EB AWS machines: | |
# Check http://www.brendangregg.com/blog/2014-09-17/node-flame-graphs-on-linux.html | |
# Change the run command to run the node process with: | |
# $ node --perf_basic_prof_only_functions index.js | |
ssh your.machine.net | |
sudo yum install perf | |
sudo sysctl kernel.kptr_restrict=0 | |
sudo sysctl kernel.perf_event_paranoid=0 | |
git clone https://github.com/brendangregg/FlameGraph | |
cd FlameGraph | |
sudo perf record -F 99 -a -g -- sleep 60 | |
sudo chmod 777 /tmp/*.map | |
sudo chown root /tmp/*.map | |
sudo perf script | ./stackcollapse-perf.pl > out.perf-folded | |
# This will remove some noise... | |
perf script | egrep -v "( __libc_start| LazyCompile | v8::internal::| Builtin:| Stub:| LoadIC:|\[unknown\]| LoadPolymorphicIC:)" | sed 's/ LazyCompile:[*~]\?/ /' | ./stackcollapse-perf.pl > out.perf-folded | |
./flamegraph.pl out.perf-folded > node-flame.svg | |
# You can move the file with `scp` or if you want | |
# You can now download your svg on from the server putting the file in the public folder. | |
# Remember to removed it once you have transfered it. | |
sudo cp *.svg /var/app/current/dist/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment