Generating Node.js Flame Graphs

Here’s how you can generate a Node flame graph with linux perf(1). Note that perf(1) needs to run as root, but the perf.map file node generates might be owned by a different user. If that’s the case, you’ll need to change its ownership to root as well — otherwise perf(1) will not be able to use it to translate JS stack frames.

$ uname -a
Linux demo 3.2.0-74-virtual #109-Ubuntu SMP Tue Dec 9 17:04:48 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
$ node --version
v5.0.0
$ node --perf-basic-prof-only-functions demo.js&
$ sudo perf record -F 99 -p `pgrep -n node` -g -- sleep 30
[ perf record: Woken up 3 times to write data ]
[ perf record: Captured and wrote 0.531 MB perf.data (~23181 samples) ]
$ ls /tmp/*.map
/tmp/perf-13083.map
$ sudo chown root /tmp/perf-13083.map
$ sudo perf script > nodestacks

Because we’re using perf-basic-prof-only-funcs, there are internal elided frames that are not mapped out, and manifest themselves as [unknown] frames, thus, we strip them out of the nodestacks output.

$ sed -i '/\[unknown\]/d' nodestacks
$ git clone --depth 1 http://github.com/brendangregg/FlameGraph
$ cd FlameGraph
$ ./stackcollapse-perf.pl < ../nodestacks | ./flamegraph.pl --colors js > ../node-flamegraph.svg

This results in a flamegraph that looks like this:

Screen Shot 2015-11-23 at 1.46.27 PM

One thing to note is that the –perf-basic-prof-only-functions flag results in a perf-<pid>.map artifact under /tmp. This file does grow over time, though at a very limited rate of around 1-2 Mb an hour. This isn’t an issue for us as most of our Node instances are transient, and routinely get killed as part of our autoscaling rules. However, if you have long running Node instances, you may want to consider monitoring the size of this file — truncating or deleting it when appropriate.


4 thoughts on “Generating Node.js Flame Graphs

  1. FREE ITUNES GIFT CARD 2018

    ====

    FREE ITUNES CARDS 2018
    ITUNES GIFT CARD CODE 2018
    FREE ITUNES GIFT CARD 2018
    ITUNES CARD CODES 2018
    FREE ITUNES GIFT CARD CODES 2018
    FREE ITUNES CODES 2018
    FREE ITUNES MONEY 2018
    FREE APPLE GIFT CARD 2018
    FREE ITUNES GIFT CARD CODES NO SURVEYS 2018
    ITUNES GIFT CARD GENERATOR 2018
    ITUNES GIFT CARD APP 2018
    FREE ITUNES CARD CODES 2018
    GET FREE ITUNES GIFT CARD 2018
    FREE ITUNES CARD REDEEM CODE 2018

    of of selecting a contraception method without sacrificing air of data. Apple is now scheduling an finish date for paid iTunes music downloads, based on sources inside the company REDEEM ITUNES present CARD ONLINE 2018. Apple Music is not broken past restore. To learn other very nearly Apple’s iTunes U program, engross go to their web site. One code, tens of millions of how to enjoy it. Use the App heap & iTunes compensation code to acquire apps, video games, music, movies and TELEVISION shows.

    Placing into observe this sturdy ASO (App increase Optimization) strategy comforts you very to reinforce your software positions and benefits you following natural forgive ITUNES present CARD CODES NO HUMAN encouragement 2018 App amassing Downloads. Music organizing software program has saved me from spending hours of my animatronics sorting my iTunes.

    ITUNES REEDEM CODES 2018
    REDEEM ITUNES GIFT CARD 2018
    ITUNES REDEEM CODE FREE 2018
    FREE ITUNES CARD REDEEM CODE 2018
    APPLE ITUNES GIFT CARD CODES 2018
    REDEEM ITUNES GIFT CARD ONLINE 2018
    FREE ITUNES GIFT CARD NO SURVEY 2018
    FREE ITUNES GIFT CARD GENERATOR 2018
    FREE ITUNES GIFT CARD CODES THAT WORK 2018
    FREE ITUNES CARD REDEEM CODE 2018
    FREE ITUNES GIFT CARD CODES NO HUMAN VERIFICATION 2018
    HOW TO WIN ITUNES GIFT CARDS 2018
    FREE ITUNES CODES LIST 2018
    FREE ITUNES CODES 2018 NOT USED
    FREE ITUNES GIFT CARD NO SURVEY NO HUMAN VERIFICATION 2018
    FREE ITUNES GIFT CARD CODES NO SURVEYS OR OFFERS 2018
    ITUNES GIFT CARD GENERATOR NO HUMAN VERIFICATION 2018
    FREE ITUNES CODES NO HUMAN VERIFICATION OR SURVEYS 2018
    FREE ITUNES GIFT CARD CODES GENERATOR 2018
    FREE ITUNES CODES NO HUMAN VERIFICATION NO SURVEY 2018
    FREE ITUNES CODES NOT USED 2018
    ITUNES GIFT CARD CODES THAT ALWAYS WORK 2018
    ITUNES GIFT CARD CODES FREE 2018
    ITUNES GIFT CARD CODES UNUSED 2018
    FREE ITUNES GIFT CARD CODES THAT WORK 2018
    FREE ITUNES GIFT CARD CODES NO SURVEYS NO VERIFICATION 2018
    FREE ITUNES GIFT CARD CODES 2018 NO SURVEYS
    EARN ITUNES GIFT CARDS WATCHING VIDEOS 2018
    EARN ITUNES GIFT CARDS FAST 2018
    FREE ITUNES GIFT CARD 2018
    HOW TO GET FREE ITUNES GIFT CARDS LEGALLY 2018
    HOW TO WIN ITUNES GIFT CARDS PRIZE WHEEL 2018
    FREE ITUNES GIFT CARD NO HUMAN VERIFICATION 2018
    FREE ITUNES CODES GENERATOR 2018
    FREE ITUNES CODES LIST 2018
    FREE ITUNES CODES 2018
    FREE ITUNES CODES 2018 NOT USED
    FREE ITUNES CODES NO HUMAN VERIFICATION 2018
    APPLE GIFT CARD 2018
    FREE APPLE GIVEAWAY 2018
    FREE APPLE GIFT CARD 2018
    APPLE GIFT CARD CODES 2018
    APPLE GIFT CARD REDEEM 2018
    ITUNES GIFT CARD ONLINE 2018
    FREE APPLE MACBOOK AIR GIVEAWAY 2018
    FREE APPLE GIFT CARD CODES NO SURVEY 2018
    FREE ITUNES GIFT CARD GENERATOR 2018
    FREE ITUNES GIFT CARD CODES THAT WORK 2018
    FREE ITUNES CARD REDEEM CODE 2018
    FREE ITUNES GIFT CARD NO HUMAN VERIFICATION 2018
    ITUNES GIFT CARD CODES UNUSED 2018
    ITUNES GIFT CARD CODE HACK 2018
    ITUNES GIFT CARD CODE FREE LIST 2018

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s