Taking Thread Dumps from ColdFusion Server Programmatically
Many times you would want to tweak the performance of the ColdFusion server or want to debug the bottlenecks that make the server unresponsive.
To analyze this, ideally you would want to have Thead dumps and Server memory snapshot(Heap Space, Eden Space, Survivor Space, Old Gen, Perm Gen).
While you can use JDK tools like jstack to get the dumps, it is tedious to install it and schedule the thread dumps.
So, programmatically thread dumps and memory snapshots are are triggered and can be configured as a scheduler task and can be triggered on-demand as well.
Download the following zip file and move it to the server where you want to take thread dumps.
Place this file under: C:ColdFusion11cfusionwwwrootWEB-INFlib and restart the server for it to load.
And the other file is the cfm file takethreaddump.cfm where the call to ThreadDump class is made and the path where the dump content should be written.
By default it is dumped to the file #GetTempDirectory()#/threaddump<Day>-<Month>-<Year>.log
(Depending on the server location it translates similar to C:ColdFusion11cfusionruntimeworkCatalinalocalhosttmpthreaddump12-8-2015.log)
You can change this to any other convenient path in the cfm file.
You can call this cfm on-demand at point of time or configure a new scheduled task to schedule it at some interval.
More number of Thread dumps are more helpful for problem analysis. So, it is better to take at some interval.
On every new day, dump is rotated automatically to a new file name.