How to generate a thread dump in DSE DataStax
When high CPU is an issue, sometimes generating a thread dump is the only way to troubleshoot. You need to see which threads are consuming memory. You can do that with DSE through the nodetool sjk:
nodetool sjk stcap -p <jmx port> -o <output filename>.std -t 300s -i 1s
The above will produce a well compacted binary file. The -t is the timeout, and -i is the interval. The above parameters mean the dump will run for 300s and collect the threads every 1s.
You can then get a flamegraph of the above thread dumps using the same sjk:
nodetool sjk ssa -f <output filename>.std --histo
Or, if you simply want to view the threads, you can use the following:
nodetool sjk ssa -f <output filename>.std --print
If you want to use an external tool, I recommend https://fastthread.io/, then you’ll need the dump in human readable format. The above can be saved to file:
nodetool sjk ssa -f <output filename>.std --print > my-threads.out
And then used in any tool.