<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>KB-2219 How to create a script to generate thread dumps automatically in Linux</title><link>https://community.appian.com/support/w/kb/2688/kb-2219-how-to-create-a-script-to-generate-thread-dumps-automatically-in-linux</link><description /><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>KB-2219 How to create a script to generate thread dumps automatically in Linux</title><link>https://community.appian.com/support/w/kb/2688/kb-2219-how-to-create-a-script-to-generate-thread-dumps-automatically-in-linux</link><pubDate>Tue, 13 Sep 2022 15:50:04 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d79833d9-80f6-4b34-9cfa-d53887126e08</guid><dc:creator>Maggie Deppe-Walker</dc:creator><comments>https://community.appian.com/support/w/kb/2688/kb-2219-how-to-create-a-script-to-generate-thread-dumps-automatically-in-linux#comments</comments><description>Current Revision posted to Appian Knowledge Base by Maggie Deppe-Walker on 9/13/2022 3:50:04 PM&lt;br /&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Purpose&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;This article outlines how to create a script that can generate thread dumps automatically for a particular Java process. You can specify&amp;nbsp;interval between each thread dump using this script.&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Instructions&lt;/span&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Create a text file named&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;ongoing_threaddumps.sh&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;in your home directory.&lt;/li&gt;
&lt;li&gt;Copy and paste the script below in the file:&lt;br /&gt;
&lt;pre&gt;#!/bin/bash&lt;br /&gt;parseArguments() {&lt;br /&gt; if [ $# -eq 0 ]; then&lt;br /&gt; echo &amp;gt;&amp;amp;1 &amp;quot;Run as appian : Usage: ongoing_threaddumps.sh &amp;lt;pid&amp;gt; &amp;lt;interval&amp;gt;&amp;quot;&lt;br /&gt; echo &amp;gt;&amp;amp;1 &amp;quot;Defaults: Interval = 30 (seconds)&amp;quot;&lt;br /&gt; exit 1&lt;br /&gt; fi&lt;br /&gt; pid=$1 # required&lt;br /&gt; interval=${2:-30} # defaults to 30 seconds&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;captureThreaddump() {&lt;br /&gt; threaddumpsDir=&amp;quot;appian_support_threaddumps/ongoing&amp;quot;&lt;br /&gt; mkdir -p ${threaddumpsDir}&lt;br /&gt; jstack -l $pid &amp;gt; ${threaddumpsDir}/threaddump_$(date -u +&amp;quot;%Y_%m_%d_%H_%M_%S&amp;quot;).log&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;captureTopOutputAppServer() {&lt;br /&gt; threadInfoDir=&amp;quot;appian_support_threaddumps/ongoing_topinfo&amp;quot;&lt;br /&gt; mkdir -p ${threadInfoDir}&lt;br /&gt; top -Hbn1 -p $pid &amp;gt; ${threadInfoDir}/threadinfo_$(date -u +&amp;quot;%Y_%m_%d_%H_%M_%S&amp;quot;).log&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;main() {&lt;br /&gt; while true&lt;br /&gt; do&lt;br /&gt; sleep $interval&lt;br /&gt; captureThreaddump&lt;br /&gt; captureTopOutputAppServer&lt;br /&gt; done&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;### Begin script execution ###&lt;br /&gt;parseArguments $*&lt;br /&gt;main&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Run the following command to add execute permissions to the file:&amp;nbsp;&lt;code&gt;chmod +x ongoing_threaddumps.sh&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Run the&amp;nbsp;script using the following syntax: &lt;code&gt;./&lt;span&gt;ongoing_threaddumps&lt;/span&gt;&lt;span&gt;.sh&lt;/span&gt; &amp;lt;java_process_pid&amp;gt; &amp;lt;interval&amp;gt; &amp;amp; disown&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&lt;/code&gt;The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;&amp;lt;java_process_pid&amp;gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;parameter is the ID of the Java process for which you are collecting thread dumps. The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;&amp;lt;interval&amp;gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;parameter represents the time in seconds between each thread dump collection.&lt;/li&gt;
&lt;li&gt;The script will create a series of thread dumps and top outputs inside a directory named&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;appian_support_threaddumps&lt;/code&gt;&amp;nbsp;located in the directory&amp;nbsp;where the script exists (in this case, it will be in your home directory).&lt;/li&gt;
&lt;li&gt;Below is an example command for taking&amp;nbsp;indefinite thread dumps at&amp;nbsp;10-second&amp;nbsp;intervals for the Java process with id 12345:
&lt;div&gt;&lt;code&gt;./&lt;span&gt;ongoing_threaddumps&lt;/span&gt;&lt;span&gt;.sh&lt;/span&gt; 12345 10 &amp;amp; disown&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;The continuous execution of the script can be terminated using the&lt;span&gt;&amp;nbsp;file:&amp;nbsp;&lt;/span&gt;&lt;code&gt;kill -9 &amp;lt;script_pid&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Affected&amp;nbsp;Versions&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;This article applies to all versions of Appian.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;Last Reviewed:&amp;nbsp;September 2022&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: linux, how-to, Performance, Cloud&lt;/div&gt;
</description></item><item><title>[SP-7812 DRAFT REV] INT-1479 How to create a script to generate thread dumps automatically in Linux</title><link>https://community.appian.com/support/w/kb/2688/kb-2219-how-to-create-a-script-to-generate-thread-dumps-automatically-in-linux/revision/11</link><pubDate>Mon, 12 Sep 2022 17:25:03 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d79833d9-80f6-4b34-9cfa-d53887126e08</guid><dc:creator>Daniel DeVeau</dc:creator><comments>https://community.appian.com/support/w/kb/2688/kb-2219-how-to-create-a-script-to-generate-thread-dumps-automatically-in-linux#comments</comments><description>Revision 11 posted to Appian Knowledge Base by Daniel DeVeau on 9/12/2022 5:25:03 PM&lt;br /&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Purpose&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;This article outlines how to create a script that can generate thread dumps automatically for a particular Java process. You can specify&amp;nbsp;interval between each thread dump using this script.&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Instructions&lt;/span&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Create a text file named&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;ongoing_threaddumps.sh&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;in your home directory.&lt;/li&gt;
&lt;li&gt;Copy and paste the script below in the file:&lt;br /&gt;
&lt;pre&gt;#!/bin/bash&lt;br /&gt;parseArguments() {&lt;br /&gt; if [ $# -eq 0 ]; then&lt;br /&gt; echo &amp;gt;&amp;amp;1 &amp;quot;Run as appian : Usage: ongoing_threaddumps.sh &amp;lt;pid&amp;gt; &amp;lt;interval&amp;gt;&amp;quot;&lt;br /&gt; echo &amp;gt;&amp;amp;1 &amp;quot;Defaults: Interval = 30 (seconds)&amp;quot;&lt;br /&gt; exit 1&lt;br /&gt; fi&lt;br /&gt; pid=$1 # required&lt;br /&gt; interval=${2:-30} # defaults to 30 seconds&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;captureThreaddump() {&lt;br /&gt; threaddumpsDir=&amp;quot;appian_support_threaddumps/ongoing&amp;quot;&lt;br /&gt; mkdir -p ${threaddumpsDir}&lt;br /&gt; jstack -l $pid &amp;gt; ${threaddumpsDir}/threaddump_$(date -u +&amp;quot;%Y_%m_%d_%H_%M_%S&amp;quot;).log&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;captureTopOutputAppServer() {&lt;br /&gt; threadInfoDir=&amp;quot;appian_support_threaddumps/ongoing_topinfo&amp;quot;&lt;br /&gt; mkdir -p ${threadInfoDir}&lt;br /&gt; top -Hbn1 -p $pid &amp;gt; ${threadInfoDir}/threadinfo_$(date -u +&amp;quot;%Y_%m_%d_%H_%M_%S&amp;quot;).log&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;main() {&lt;br /&gt; while true&lt;br /&gt; do&lt;br /&gt; sleep $interval&lt;br /&gt; captureThreaddump&lt;br /&gt; captureTopOutputAppServer&lt;br /&gt; done&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;### Begin script execution ###&lt;br /&gt;parseArguments $*&lt;br /&gt;main&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Run the following command to add execute permissions to the file:&amp;nbsp;&lt;code&gt;chmod +x ongoing_threaddumps.sh&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Run the&amp;nbsp;script using the following syntax: &lt;code&gt;./&lt;span&gt;ongoing_threaddumps&lt;/span&gt;&lt;span&gt;.sh&lt;/span&gt; &amp;lt;java_process_pid&amp;gt; &amp;lt;interval&amp;gt; &amp;amp; disown&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&lt;/code&gt;The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;&amp;lt;java_process_pid&amp;gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;parameter is the ID of the Java process for which you are collecting thread dumps. The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;&amp;lt;interval&amp;gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;parameter represents the time in seconds between each thread dump collection.&lt;/li&gt;
&lt;li&gt;The script will create a series of thread dumps and top outputs inside a directory named&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;appian_support_threaddumps&lt;/code&gt;&amp;nbsp;located in the directory&amp;nbsp;where the script exists (in this case, it will be in your home directory).&lt;/li&gt;
&lt;li&gt;Below is an example command for taking&amp;nbsp;indefinite thread dumps at&amp;nbsp;10-second&amp;nbsp;intervals for the Java process with id 12345:
&lt;div&gt;&lt;code&gt;./&lt;span&gt;ongoing_threaddumps&lt;/span&gt;&lt;span&gt;.sh&lt;/span&gt; 12345 10 &amp;amp; disown&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;The continuous execution of the script can be terminated using the&lt;span&gt;&amp;nbsp;file:&amp;nbsp;&lt;/span&gt;&lt;code&gt;kill -9 &amp;lt;script_pid&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Affected&amp;nbsp;Versions&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;This article applies to all versions of Appian.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;Last Reviewed:&amp;nbsp;September 2022&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: linux, how-to, Performance, Cloud&lt;/div&gt;
</description></item><item><title>[SP-7812 DRAFT REV] INT-1479 How to create a script to generate thread dumps automatically in Linux</title><link>https://community.appian.com/support/w/kb/2688/kb-2219-how-to-create-a-script-to-generate-thread-dumps-automatically-in-linux/revision/10</link><pubDate>Mon, 12 Sep 2022 17:24:09 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d79833d9-80f6-4b34-9cfa-d53887126e08</guid><dc:creator>Daniel DeVeau</dc:creator><comments>https://community.appian.com/support/w/kb/2688/kb-2219-how-to-create-a-script-to-generate-thread-dumps-automatically-in-linux#comments</comments><description>Revision 10 posted to Appian Knowledge Base by Daniel DeVeau on 9/12/2022 5:24:09 PM&lt;br /&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Purpose&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;This article outlines how to create a script that can generate thread dumps automatically for a particular Java process. You can specify&amp;nbsp;interval between each thread dump using this script.&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Instructions&lt;/span&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Create a text file named&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;ongoing_threaddumps.sh&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;in your home directory. Thread dumps will be created in the directory where the script lives.&lt;/li&gt;
&lt;li&gt;Copy and paste the script below in the file:&lt;br /&gt;
&lt;pre&gt;#!/bin/bash&lt;br /&gt;parseArguments() {&lt;br /&gt; if [ $# -eq 0 ]; then&lt;br /&gt; echo &amp;gt;&amp;amp;1 &amp;quot;Run as appian : Usage: ongoing_threaddumps.sh &amp;lt;pid&amp;gt; &amp;lt;interval&amp;gt;&amp;quot;&lt;br /&gt; echo &amp;gt;&amp;amp;1 &amp;quot;Defaults: Interval = 30 (seconds)&amp;quot;&lt;br /&gt; exit 1&lt;br /&gt; fi&lt;br /&gt; pid=$1 # required&lt;br /&gt; interval=${2:-30} # defaults to 30 seconds&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;captureThreaddump() {&lt;br /&gt; threaddumpsDir=&amp;quot;appian_support_threaddumps/ongoing&amp;quot;&lt;br /&gt; mkdir -p ${threaddumpsDir}&lt;br /&gt; jstack -l $pid &amp;gt; ${threaddumpsDir}/threaddump_$(date -u +&amp;quot;%Y_%m_%d_%H_%M_%S&amp;quot;).log&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;captureTopOutputAppServer() {&lt;br /&gt; threadInfoDir=&amp;quot;appian_support_threaddumps/ongoing_topinfo&amp;quot;&lt;br /&gt; mkdir -p ${threadInfoDir}&lt;br /&gt; top -Hbn1 -p $pid &amp;gt; ${threadInfoDir}/threadinfo_$(date -u +&amp;quot;%Y_%m_%d_%H_%M_%S&amp;quot;).log&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;main() {&lt;br /&gt; while true&lt;br /&gt; do&lt;br /&gt; sleep $interval&lt;br /&gt; captureThreaddump&lt;br /&gt; captureTopOutputAppServer&lt;br /&gt; done&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;### Begin script execution ###&lt;br /&gt;parseArguments $*&lt;br /&gt;main&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Run the following command to add execute permissions to the file:&amp;nbsp;&lt;code&gt;chmod +x ongoing_threaddumps.sh&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Run the&amp;nbsp;script using the following syntax: &lt;code&gt;./&lt;span&gt;ongoing_threaddumps&lt;/span&gt;&lt;span&gt;.sh&lt;/span&gt; &amp;lt;java_process_pid&amp;gt; &amp;lt;interval&amp;gt; &amp;amp; disown&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&lt;/code&gt;The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;&amp;lt;java_process_pid&amp;gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;parameter is the ID of the Java process for which you are collecting thread dumps. The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;&amp;lt;interval&amp;gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;parameter represents the time in seconds between each thread dump collection.&lt;/li&gt;
&lt;li&gt;The script will create a series of thread dumps and top outputs inside a directory named&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;appian_support_threaddumps&lt;/code&gt;&amp;nbsp;located in the directory&amp;nbsp;where the script exists (in this case, it will be in your home directory).&lt;/li&gt;
&lt;li&gt;Below is an example command for taking&amp;nbsp;indefinite thread dumps at&amp;nbsp;10-second&amp;nbsp;intervals for the Java process with id 12345:
&lt;div&gt;&lt;code&gt;./&lt;span&gt;ongoing_threaddumps&lt;/span&gt;&lt;span&gt;.sh&lt;/span&gt; 12345 10 &amp;amp; disown&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;The continuous execution of the script can be terminated using the&lt;span&gt;&amp;nbsp;file:&amp;nbsp;&lt;/span&gt;&lt;code&gt;kill -9 &amp;lt;script_pid&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Affected&amp;nbsp;Versions&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;This article applies to all versions of Appian.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;Last Reviewed:&amp;nbsp;September 2022&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: linux, how-to, Performance, Cloud&lt;/div&gt;
</description></item><item><title>[SP-7812 DRAFT REV] INT-1479 How to create a script to generate thread dumps automatically in Linux</title><link>https://community.appian.com/support/w/kb/2688/kb-2219-how-to-create-a-script-to-generate-thread-dumps-automatically-in-linux/revision/9</link><pubDate>Mon, 12 Sep 2022 17:22:47 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d79833d9-80f6-4b34-9cfa-d53887126e08</guid><dc:creator>Daniel DeVeau</dc:creator><comments>https://community.appian.com/support/w/kb/2688/kb-2219-how-to-create-a-script-to-generate-thread-dumps-automatically-in-linux#comments</comments><description>Revision 9 posted to Appian Knowledge Base by Daniel DeVeau on 9/12/2022 5:22:47 PM&lt;br /&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Purpose&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;This article outlines how to create a script that can generate thread dumps automatically for a particular Java process. You can specify&amp;nbsp;interval between each thread dump using this script.&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Instructions&lt;/span&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Create a text file named&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;ongoing_threaddumps.sh&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;in your home directory.&lt;/li&gt;
&lt;li&gt;Copy and paste the script below in the file:&lt;br /&gt;
&lt;pre&gt;#!/bin/bash&lt;br /&gt;parseArguments() {&lt;br /&gt; if [ $# -eq 0 ]; then&lt;br /&gt; echo &amp;gt;&amp;amp;1 &amp;quot;Run as appian : Usage: ongoing_threaddumps.sh &amp;lt;pid&amp;gt; &amp;lt;interval&amp;gt;&amp;quot;&lt;br /&gt; echo &amp;gt;&amp;amp;1 &amp;quot;Defaults: Interval = 30 (seconds)&amp;quot;&lt;br /&gt; exit 1&lt;br /&gt; fi&lt;br /&gt; pid=$1 # required&lt;br /&gt; interval=${2:-30} # defaults to 30 seconds&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;captureThreaddump() {&lt;br /&gt; threaddumpsDir=&amp;quot;appian_support_threaddumps/ongoing&amp;quot;&lt;br /&gt; mkdir -p ${threaddumpsDir}&lt;br /&gt; jstack -l $pid &amp;gt; ${threaddumpsDir}/threaddump_$(date -u +&amp;quot;%Y_%m_%d_%H_%M_%S&amp;quot;).log&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;captureTopOutputAppServer() {&lt;br /&gt; threadInfoDir=&amp;quot;appian_support_threaddumps/ongoing_topinfo&amp;quot;&lt;br /&gt; mkdir -p ${threadInfoDir}&lt;br /&gt; top -Hbn1 -p $pid &amp;gt; ${threadInfoDir}/threadinfo_$(date -u +&amp;quot;%Y_%m_%d_%H_%M_%S&amp;quot;).log&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;main() {&lt;br /&gt; while true&lt;br /&gt; do&lt;br /&gt; sleep $interval&lt;br /&gt; captureThreaddump&lt;br /&gt; captureTopOutputAppServer&lt;br /&gt; done&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;### Begin script execution ###&lt;br /&gt;parseArguments $*&lt;br /&gt;main&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Run the following command to add execute permissions to the file:&amp;nbsp;&lt;code&gt;chmod +x ongoing_threaddumps.sh&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Run the&amp;nbsp;script using the following syntax: &lt;code&gt;./&lt;span&gt;ongoing_threaddumps&lt;/span&gt;&lt;span&gt;.sh&lt;/span&gt; &amp;lt;java_process_pid&amp;gt; &amp;lt;interval&amp;gt; &amp;amp; disown&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&lt;/code&gt;The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;&amp;lt;java_process_pid&amp;gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;parameter is the ID of the Java process for which you are collecting thread dumps. The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;&amp;lt;interval&amp;gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;parameter represents the time in seconds between each thread dump collection.&lt;/li&gt;
&lt;li&gt;The script will create a series of thread dumps and top outputs inside a directory named&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;appian_support_threaddumps&lt;/code&gt;&amp;nbsp;located in the directory&amp;nbsp;where the script exists (in this case, it will be in your home directory).&lt;/li&gt;
&lt;li&gt;Below is an example command for taking&amp;nbsp;indefinite thread dumps at&amp;nbsp;10-second&amp;nbsp;intervals for the Java process with id 12345:
&lt;div&gt;&lt;code&gt;./&lt;span&gt;ongoing_threaddumps&lt;/span&gt;&lt;span&gt;.sh&lt;/span&gt; 12345 10 &amp;amp; disown&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;The continuous execution of the script can be terminated using the&lt;span&gt;&amp;nbsp;file:&amp;nbsp;&lt;/span&gt;&lt;code&gt;kill -9 &amp;lt;script_pid&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Affected&amp;nbsp;Versions&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;This article applies to all versions of Appian.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;Last Reviewed:&amp;nbsp;September 2022&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: linux, how-to, Performance, Cloud&lt;/div&gt;
</description></item><item><title>[SP-7812 DRAFT REV] INT-1479 How to create a script to generate thread dumps automatically in Linux</title><link>https://community.appian.com/support/w/kb/2688/kb-2219-how-to-create-a-script-to-generate-thread-dumps-automatically-in-linux/revision/8</link><pubDate>Thu, 08 Sep 2022 18:51:02 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d79833d9-80f6-4b34-9cfa-d53887126e08</guid><dc:creator>Maggie Deppe-Walker</dc:creator><comments>https://community.appian.com/support/w/kb/2688/kb-2219-how-to-create-a-script-to-generate-thread-dumps-automatically-in-linux#comments</comments><description>Revision 8 posted to Appian Knowledge Base by Maggie Deppe-Walker on 9/8/2022 6:51:02 PM&lt;br /&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Purpose&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;This article outlines how to create a script that can generate thread dumps automatically for a particular Java process. You can specify&amp;nbsp;interval between each thread dump using this script.&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Instructions&lt;/span&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Create a text file named&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;ongoing_threaddumps.sh&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;in your home directory.&lt;/li&gt;
&lt;li&gt;Copy and paste the script below in the file:&lt;br /&gt;
&lt;pre&gt;#!/bin/bash&lt;br /&gt;parseArguments() {&lt;br /&gt; if [ $# -eq 0 ]; then&lt;br /&gt; echo &amp;gt;&amp;amp;1 &amp;quot;Run as appian : Usage: ongoing_threaddumps.sh &amp;lt;pid&amp;gt; &amp;lt;interval&amp;gt;&amp;quot;&lt;br /&gt; echo &amp;gt;&amp;amp;1 &amp;quot;Defaults: Interval = 30 (seconds)&amp;quot;&lt;br /&gt; exit 1&lt;br /&gt; fi&lt;br /&gt; pid=$1 # required&lt;br /&gt; interval=${2:-30} # defaults to 30 seconds&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;captureThreaddump() {&lt;br /&gt; threaddumpsDir=&amp;quot;appian_support_threaddumps/ongoing&amp;quot;&lt;br /&gt; mkdir -p ${threaddumpsDir}&lt;br /&gt; jstack -l $pid &amp;gt; ${threaddumpsDir}/threaddump_$(date -u +&amp;quot;%Y_%m_%d_%H_%M_%S&amp;quot;).log&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;captureTopOutputAppServer() {&lt;br /&gt; threadInfoDir=&amp;quot;appian_support_threaddumps/ongoing_topinfo&amp;quot;&lt;br /&gt; mkdir -p ${threadInfoDir}&lt;br /&gt; top -Hbn1 -p $pid &amp;gt; ${threadInfoDir}/threadinfo_$(date -u +&amp;quot;%Y_%m_%d_%H_%M_%S&amp;quot;).log&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;main() {&lt;br /&gt; while true&lt;br /&gt; do&lt;br /&gt; sleep $interval&lt;br /&gt; captureThreaddump&lt;br /&gt; captureTopOutputAppServer&lt;br /&gt; done&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;### Begin script execution ###&lt;br /&gt;parseArguments $*&lt;br /&gt;main&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Run the following command to add execute permissions to the file:&amp;nbsp;&lt;code&gt;chmod +x ongoing_threaddumps.sh&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Run the&amp;nbsp;script using the following syntax: &lt;code&gt;./&lt;span&gt;ongoing_threaddumps&lt;/span&gt;&lt;span&gt;.sh&lt;/span&gt; &amp;lt;java_process_pid&amp;gt; &amp;lt;interval&amp;gt; &amp;amp; disown&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&lt;/code&gt;The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;&amp;lt;java_process_pid&amp;gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;parameter is the ID of the Java process for which you are collecting thread dumps. The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;&amp;lt;interval&amp;gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;parameter represents the time in seconds between each thread dump collection.&lt;/li&gt;
&lt;li&gt;The script will create a series of thread dumps and top outputs inside a directory named&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;appian_support_threaddumps&lt;/code&gt;&amp;nbsp;located in the directory&amp;nbsp;where the script exists (in this case, it will be in your home directory).&lt;/li&gt;
&lt;li&gt;Below is an example command for taking&amp;nbsp;indefinite thread dumps at&amp;nbsp;10-second&amp;nbsp;intervals for the Java process with id 12345:
&lt;div&gt;&lt;code&gt;./&lt;span&gt;ongoing_threaddumps&lt;/span&gt;&lt;span&gt;.sh&lt;/span&gt; 12345 10 &amp;amp; disown&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;The continuous execution of the script can be terminated using the&lt;span&gt;&amp;nbsp;file:&amp;nbsp;&lt;/span&gt;&lt;code&gt;kill - 9 &amp;lt;script_pid&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Affected&amp;nbsp;Versions&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;This article applies to all versions of Appian.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;Last Reviewed:&amp;nbsp;September 2022&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: linux, how-to, Performance, Cloud&lt;/div&gt;
</description></item><item><title>[SP-7812 DRAFT REV] INT-1479 How to create a script to generate thread dumps automatically in Linux</title><link>https://community.appian.com/support/w/kb/2688/kb-2219-how-to-create-a-script-to-generate-thread-dumps-automatically-in-linux/revision/7</link><pubDate>Thu, 25 Aug 2022 15:54:42 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d79833d9-80f6-4b34-9cfa-d53887126e08</guid><dc:creator>Raj Kaladeen</dc:creator><comments>https://community.appian.com/support/w/kb/2688/kb-2219-how-to-create-a-script-to-generate-thread-dumps-automatically-in-linux#comments</comments><description>Revision 7 posted to Appian Knowledge Base by Raj Kaladeen on 8/25/2022 3:54:42 PM&lt;br /&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Purpose&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;This article outlines how to create a script that can generate thread dumps automatically for a particular Java process. You specify&amp;nbsp;interval between each thread dump using this script.&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Instructions&lt;/span&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Create a text file named&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;ongoing_threaddumps.sh&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;in your home directory.&lt;/li&gt;
&lt;li&gt;Copy and paste the script below in the file:&lt;br /&gt;
&lt;pre&gt;#!/bin/bash&lt;br /&gt;parseArguments() {&lt;br /&gt; if [ $# -eq 0 ]; then&lt;br /&gt; echo &amp;gt;&amp;amp;1 &amp;quot;Run as appian : Usage: ongoing_threaddumps.sh &amp;lt;pid&amp;gt; &amp;lt;interval&amp;gt;&amp;quot;&lt;br /&gt; echo &amp;gt;&amp;amp;1 &amp;quot;Defaults: Interval = 30 (seconds)&amp;quot;&lt;br /&gt; exit 1&lt;br /&gt; fi&lt;br /&gt; pid=$1 # required&lt;br /&gt; interval=${2:-30} # defaults to 30 seconds&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;captureThreaddump() {&lt;br /&gt; threaddumpsDir=&amp;quot;appian_support_threaddumps/ongoing&amp;quot;&lt;br /&gt; mkdir -p ${threaddumpsDir}&lt;br /&gt; jstack -l $pid &amp;gt; ${threaddumpsDir}/threaddump_$(date -u +&amp;quot;%Y_%m_%d_%H_%M_%S&amp;quot;).log&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;captureTopOutputAppServer() {&lt;br /&gt; threadInfoDir=&amp;quot;appian_support_threaddumps/ongoing_topinfo&amp;quot;&lt;br /&gt; mkdir -p ${threadInfoDir}&lt;br /&gt; top -Hbn1 -p $pid &amp;gt; ${threadInfoDir}/threadinfo_$(date -u +&amp;quot;%Y_%m_%d_%H_%M_%S&amp;quot;).log&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;main() {&lt;br /&gt; while true&lt;br /&gt; do&lt;br /&gt; sleep $interval&lt;br /&gt; captureThreaddump&lt;br /&gt; captureTopOutputAppServer&lt;br /&gt; done&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;### Begin script execution ###&lt;br /&gt;parseArguments $*&lt;br /&gt;main&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Run the following command to add execute permissions to the file:&amp;nbsp;&lt;code&gt;chmod +x ongoing_threaddumps.sh&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Run the command using the following syntax:&lt;/li&gt;
&lt;/ol&gt;
&lt;pre&gt;./&lt;span&gt;ongoing_threaddumps&lt;/span&gt;&lt;span&gt;.sh&lt;/span&gt; &amp;lt;java_process_pid&amp;gt; &amp;lt;interval&amp;gt; &amp;amp; disown&lt;/pre&gt;
&lt;p&gt;The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;&amp;lt;java_process_pid&amp;gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;parameter is the ID of the Java process for which you are collecting thread dumps. The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;&amp;lt;interval&amp;gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;parameter represents the time in seconds between each thread dump collection.&lt;/p&gt;
&lt;p&gt;Below is an example for taking&amp;nbsp;indefinite thread dumps at&amp;nbsp;10-second&amp;nbsp;intervals for the Java process with id 12345:&lt;/p&gt;
&lt;pre&gt;./&lt;span&gt;ongoing_threaddumps&lt;/span&gt;&lt;span&gt;.sh&lt;/span&gt; 12345 10 &amp;amp; disown&lt;/pre&gt;
&lt;p&gt;The script will create a series of thread dumps and top outputs, inside a directory named&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;appian_support_threaddumps&lt;/code&gt;, in the directory in which the script exists (in this case, it will be in your home directory).&lt;/p&gt;
&lt;p&gt;The continuous execution of the script can be terminated using the&lt;span&gt;&amp;nbsp;file:&amp;nbsp;&lt;/span&gt;&lt;code&gt;kill - 9 &amp;lt;script_pid&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Affected&amp;nbsp;Versions&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;This article applies to all versions of Appian.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;Last Reviewed: January 2018&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: linux, how-to, Performance, Cloud&lt;/div&gt;
</description></item><item><title>[SP-7812 DRAFT REV] INT-1479 How to create a script to generate thread dumps automatically in Linux</title><link>https://community.appian.com/support/w/kb/2688/kb-2219-how-to-create-a-script-to-generate-thread-dumps-automatically-in-linux/revision/6</link><pubDate>Thu, 25 Aug 2022 15:49:27 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d79833d9-80f6-4b34-9cfa-d53887126e08</guid><dc:creator>Raj Kaladeen</dc:creator><comments>https://community.appian.com/support/w/kb/2688/kb-2219-how-to-create-a-script-to-generate-thread-dumps-automatically-in-linux#comments</comments><description>Revision 6 posted to Appian Knowledge Base by Raj Kaladeen on 8/25/2022 3:49:27 PM&lt;br /&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Purpose&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;This article outlines how to create a script that can generate thread dumps automatically for a particular Java process. You specify&amp;nbsp;interval between each thread dump using this script.&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Instructions&lt;/span&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Create a text file named&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;ongoing_threaddumps.sh&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;in your home directory.&lt;/li&gt;
&lt;li&gt;Copy and paste the script below in the file:&lt;br /&gt;
&lt;pre&gt;#!/bin/bash&lt;br /&gt;parseArguments() {&lt;br /&gt; if [ $# -eq 0 ]; then&lt;br /&gt; echo &amp;gt;&amp;amp;1 &amp;quot;Run as appian : Usage: ongoing_metrics.sh &amp;lt;pid&amp;gt; &amp;lt;interval&amp;gt;&amp;quot;&lt;br /&gt; echo &amp;gt;&amp;amp;1 &amp;quot;Defaults: Interval = 30 (seconds)&amp;quot;&lt;br /&gt; exit 1&lt;br /&gt; fi&lt;br /&gt; pid=$1 # required&lt;br /&gt; interval=${2:-30} # defaults to 30 seconds&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;captureThreaddump() {&lt;br /&gt; threaddumpsDir=&amp;quot;appian_support_threaddumps/ongoing&amp;quot;&lt;br /&gt; mkdir -p ${threaddumpsDir}&lt;br /&gt; jstack -l $pid &amp;gt; ${threaddumpsDir}/threaddump_$(date -u +&amp;quot;%Y_%m_%d_%H_%M_%S&amp;quot;).log&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;captureTopOutputAppServer() {&lt;br /&gt; threadInfoDir=&amp;quot;appian_support_threaddumps/ongoing_topinfo&amp;quot;&lt;br /&gt; mkdir -p ${threadInfoDir}&lt;br /&gt; top -Hbn1 -p $pid &amp;gt; ${threadInfoDir}/threadinfo_$(date -u +&amp;quot;%Y_%m_%d_%H_%M_%S&amp;quot;).log&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;main() {&lt;br /&gt; while true&lt;br /&gt; do&lt;br /&gt; sleep $interval&lt;br /&gt; captureThreaddump&lt;br /&gt; captureTopOutputAppServer&lt;br /&gt; done&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;### Begin script execution ###&lt;br /&gt;parseArguments $*&lt;br /&gt;main&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Run the following command to add execute permissions to the file:&amp;nbsp;&lt;code&gt;chmod +x ongoing_threaddumps.sh&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Run the command using the following syntax:&lt;/li&gt;
&lt;/ol&gt;
&lt;pre&gt;./&lt;span&gt;ongoing_threaddumps&lt;/span&gt;&lt;span&gt;.sh&lt;/span&gt; &amp;lt;java_process_pid&amp;gt; &amp;lt;interval&amp;gt; &amp;amp; disown&lt;/pre&gt;
&lt;p&gt;The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;&amp;lt;java_process_pid&amp;gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;parameter is the ID of the Java process for which you are collecting thread dumps. The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;&amp;lt;interval&amp;gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;parameter represents the time in seconds between each thread dump collection.&lt;/p&gt;
&lt;p&gt;Below is an example for taking&amp;nbsp;indefinite thread dumps at&amp;nbsp;10-second&amp;nbsp;intervals for the Java process with id 12345:&lt;/p&gt;
&lt;pre&gt;./&lt;span&gt;ongoing_threaddumps&lt;/span&gt;&lt;span&gt;.sh&lt;/span&gt; 12345 10 &amp;amp; disown&lt;/pre&gt;
&lt;p&gt;The script will create a series of thread dumps and top outputs, inside a directory named&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;appian_support_threaddumps&lt;/code&gt;, in the directory in which the script exists (in this case, it will be in your home directory).&lt;/p&gt;
&lt;p&gt;The continuous execution of the script can be terminated using the&lt;span&gt;&amp;nbsp;file:&amp;nbsp;&lt;/span&gt;&lt;code&gt;kill - 9 &amp;lt;script_pid&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Affected&amp;nbsp;Versions&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;This article applies to all versions of Appian.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;Last Reviewed: January 2018&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: linux, how-to, Performance, Cloud&lt;/div&gt;
</description></item><item><title>[SP-7812 DRAFT REV] INT-1479 How to create a script to generate thread dumps automatically in Linux</title><link>https://community.appian.com/support/w/kb/2688/kb-2219-how-to-create-a-script-to-generate-thread-dumps-automatically-in-linux/revision/5</link><pubDate>Thu, 25 Aug 2022 14:50:18 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d79833d9-80f6-4b34-9cfa-d53887126e08</guid><dc:creator>Raj Kaladeen</dc:creator><comments>https://community.appian.com/support/w/kb/2688/kb-2219-how-to-create-a-script-to-generate-thread-dumps-automatically-in-linux#comments</comments><description>Revision 5 posted to Appian Knowledge Base by Raj Kaladeen on 8/25/2022 2:50:18 PM&lt;br /&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Purpose&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;This article outlines how to create a script that can generate thread dumps automatically for a particular Java process. You specify&amp;nbsp;interval between each thread dump using this script.&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Instructions&lt;/span&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Create a text file named&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;ongoing_threaddumps.sh&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;in your home directory.&lt;/li&gt;
&lt;li&gt;Copy and paste the script below in the file:&lt;br /&gt;
&lt;pre&gt;#!/bin/bash&lt;br /&gt;parseArguments() {&lt;br /&gt; if [ $# -eq 0 ]; then&lt;br /&gt; echo &amp;gt;&amp;amp;1 &amp;quot;Run as appian : Usage: ongoing_metrics.sh &amp;lt;java_process_pid&amp;gt; &amp;lt;interval&amp;gt;&amp;quot;&lt;br /&gt; echo &amp;gt;&amp;amp;1 &amp;quot;Defaults: Interval = 30 (seconds)&amp;quot;&lt;br /&gt; exit 1&lt;br /&gt; fi&lt;br /&gt; pid=$1 # required&lt;br /&gt; interval=${2:-30} # defaults to 30 seconds&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;captureThreaddump() {&lt;br /&gt; threaddumpsDir=&amp;quot;appian_support_threaddumps/threaddumps&amp;quot;&lt;br /&gt; mkdir -p ${threaddumpsDir}&lt;br /&gt; jstack -l $pid &amp;gt; appian_support_server_metrics/threaddumps/threaddump.$pid.$(date -u +&amp;quot;%H_%M_%S&amp;quot;)&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;captureTopOutputAppServer() {&lt;br /&gt; top_app_serverDir=&amp;quot;appian_support_threaddumps/top_app_server&amp;quot;&lt;br /&gt; mkdir -p ${top_app_serverDir}&lt;br /&gt; top -Hbn1 -p $pid &amp;gt; appian_support_server_metrics/top_app_server/top_app_server.$pid.$(date -u +&amp;quot;%H_%M_%S&amp;quot;)&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;main() {&lt;br /&gt; while true&lt;br /&gt; do&lt;br /&gt; sleep $interval&lt;br /&gt; captureThreaddump&lt;br /&gt; captureTopOutputAppServer&lt;br /&gt; done&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;### Begin script execution ###&lt;br /&gt;parseArguments $*&lt;br /&gt;main&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Run the following command to add execute permissions to the file:&amp;nbsp;&lt;code&gt;chmod +x ongoing_threaddumps.sh&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Run the command using the following syntax:&lt;/li&gt;
&lt;/ol&gt;
&lt;pre&gt;./&lt;span&gt;ongoing_threaddumps&lt;/span&gt;&lt;span&gt;.sh&lt;/span&gt; &amp;lt;java_process_pid&amp;gt; &amp;lt;interval&amp;gt; &amp;amp; disown&lt;/pre&gt;
&lt;p&gt;The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;&amp;lt;java_process_pid&amp;gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;parameter is the ID of the Java process for which you are collecting thread dumps. The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;&amp;lt;interval&amp;gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;parameter represents the time in seconds between each thread dump collection.&lt;/p&gt;
&lt;p&gt;Below is an example for taking&amp;nbsp;indefinite thread dumps at&amp;nbsp;10-second&amp;nbsp;intervals for the Java process with id 12345:&lt;/p&gt;
&lt;pre&gt;./&lt;span&gt;ongoing_threaddumps&lt;/span&gt;&lt;span&gt;.sh&lt;/span&gt; 12345 10 &amp;amp; disown&lt;/pre&gt;
&lt;p&gt;The script will create a series of thread dumps and top outputs, inside a directory named&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;appian_support_threaddumps&lt;/code&gt;, in the directory in which the script exists (in this case, it will be in your home directory).&lt;/p&gt;
&lt;p&gt;The continuous execution of the script can be terminated using the&lt;span&gt;&amp;nbsp;file:&amp;nbsp;&lt;/span&gt;&lt;code&gt;kill - 9 &amp;lt;script_pid&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Affected&amp;nbsp;Versions&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;This article applies to all versions of Appian.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;Last Reviewed: January 2018&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: linux, how-to, Performance, Cloud&lt;/div&gt;
</description></item><item><title>[SP-7812 DRAFT REV] INT-1479 How to create a script to generate thread dumps automatically in Linux</title><link>https://community.appian.com/support/w/kb/2688/kb-2219-how-to-create-a-script-to-generate-thread-dumps-automatically-in-linux/revision/4</link><pubDate>Wed, 24 Aug 2022 20:24:03 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d79833d9-80f6-4b34-9cfa-d53887126e08</guid><dc:creator>Raj Kaladeen</dc:creator><comments>https://community.appian.com/support/w/kb/2688/kb-2219-how-to-create-a-script-to-generate-thread-dumps-automatically-in-linux#comments</comments><description>Revision 4 posted to Appian Knowledge Base by Raj Kaladeen on 8/24/2022 8:24:03 PM&lt;br /&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Purpose&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;This article outlines how to create a script that can generate thread dumps automatically for a particular Java process. You can specify the number of threads and the time between each thread dump using this script.&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Instructions&lt;/span&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Create a text file named&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;ongoing_threaddumps.sh&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;in your home directory.&lt;/li&gt;
&lt;li&gt;Copy and paste the script below in the file:&lt;br /&gt;
&lt;pre&gt;#!/bin/bash&lt;br /&gt;parseArguments() {&lt;br /&gt; if [ $# -eq 0 ]; then&lt;br /&gt; echo &amp;gt;&amp;amp;1 &amp;quot;Run as appian : Usage: ongoing_metrics.sh &amp;lt;java_process_pid&amp;gt; &amp;lt;interval&amp;gt;&amp;quot;&lt;br /&gt; echo &amp;gt;&amp;amp;1 &amp;quot;Defaults: Interval = 30 (seconds)&amp;quot;&lt;br /&gt; exit 1&lt;br /&gt; fi&lt;br /&gt; pid=$1 # required&lt;br /&gt; interval=${2:-30} # defaults to 30 seconds&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;captureThreaddump() {&lt;br /&gt; threaddumpsDir=&amp;quot;appian_support_threaddumps/threaddumps&amp;quot;&lt;br /&gt; mkdir -p ${threaddumpsDir}&lt;br /&gt; jstack -l $pid &amp;gt; appian_support_server_metrics/threaddumps/threaddump.$pid.$(date -u +&amp;quot;%H_%M_%S&amp;quot;)&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;captureTopOutputAppServer() {&lt;br /&gt; top_app_serverDir=&amp;quot;appian_support_threaddumps/top_app_server&amp;quot;&lt;br /&gt; mkdir -p ${top_app_serverDir}&lt;br /&gt; top -Hbn1 -p $pid &amp;gt; appian_support_server_metrics/top_app_server/top_app_server.$pid.$(date -u +&amp;quot;%H_%M_%S&amp;quot;)&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;main() {&lt;br /&gt; while true&lt;br /&gt; do&lt;br /&gt; sleep $interval&lt;br /&gt; captureThreaddump&lt;br /&gt; captureTopOutputAppServer&lt;br /&gt; done&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;### Begin script execution ###&lt;br /&gt;parseArguments $*&lt;br /&gt;main&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Run the following command to add execute permissions to the file:&amp;nbsp;&lt;code&gt;chmod +x ongoing_threaddumps.sh&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Run the command using the following syntax:&lt;/li&gt;
&lt;/ol&gt;
&lt;pre&gt;./&lt;span&gt;ongoing_threaddumps&lt;/span&gt;&lt;span&gt;.sh&lt;/span&gt; &amp;lt;java_process_pid&amp;gt; &amp;lt;interval&amp;gt; &amp;amp; disown&lt;/pre&gt;
&lt;p&gt;The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;&amp;lt;java_process_pid&amp;gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;parameter is the ID of the Java process for which you are collecting thread dumps. The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;&amp;lt;interval&amp;gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;parameter represents the time in seconds between each thread dump collection.&lt;/p&gt;
&lt;p&gt;Below is an example for taking&amp;nbsp;indefinite thread dumps at&amp;nbsp;10-second&amp;nbsp;intervals for the Java process with id 12345:&lt;/p&gt;
&lt;pre&gt;./&lt;span&gt;ongoing_threaddumps&lt;/span&gt;&lt;span&gt;.sh&lt;/span&gt; 12345 10 &amp;amp; disown&lt;/pre&gt;
&lt;p&gt;The script will create a series of thread dumps and top outputs, inside a directory named&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;appian_support_threaddumps&lt;/code&gt;, in the directory in which the script exists (in this case, it will be in your home directory).&lt;/p&gt;
&lt;p&gt;The continuous execution of the script can be terminated using the&lt;span&gt;&amp;nbsp;file:&amp;nbsp;&lt;/span&gt;&lt;code&gt;kill - 9 &amp;lt;script_pid&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Affected&amp;nbsp;Versions&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;This article applies to all versions of Appian.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;Last Reviewed: January 2018&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: linux, how-to, Performance, Cloud&lt;/div&gt;
</description></item><item><title>[SP-7812 DRAFT REV] INT-1479 How to create a script to generate thread dumps automatically in Linux</title><link>https://community.appian.com/support/w/kb/2688/kb-2219-how-to-create-a-script-to-generate-thread-dumps-automatically-in-linux/revision/3</link><pubDate>Wed, 24 Aug 2022 19:32:40 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d79833d9-80f6-4b34-9cfa-d53887126e08</guid><dc:creator>Raj Kaladeen</dc:creator><comments>https://community.appian.com/support/w/kb/2688/kb-2219-how-to-create-a-script-to-generate-thread-dumps-automatically-in-linux#comments</comments><description>Revision 3 posted to Appian Knowledge Base by Raj Kaladeen on 8/24/2022 7:32:40 PM&lt;br /&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Purpose&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;This article outlines how to create a script that can generate thread dumps automatically for a particular Java process. You can specify the number of threads and the time between each thread dump using this script.&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Instructions&lt;/span&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Create a text file named&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;ongoing_threaddumps.sh&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;in your home directory.&lt;/li&gt;
&lt;li&gt;Copy and paste the script below in the file:&lt;br /&gt;
&lt;pre&gt;#!/bin/bash&lt;br /&gt;parseArguments() {&lt;br /&gt; if [ $# -eq 0 ]; then&lt;br /&gt; echo &amp;gt;&amp;amp;1 &amp;quot;Run as appian : Usage: ongoing_metrics.sh &amp;lt;java_process_pid&amp;gt; &amp;lt;interval&amp;gt;&amp;quot;&lt;br /&gt; echo &amp;gt;&amp;amp;1 &amp;quot;Defaults: Interval = 30 (seconds)&amp;quot;&lt;br /&gt; exit 1&lt;br /&gt; fi&lt;br /&gt; pid=$1 # required&lt;br /&gt; interval=${2:-30} # defaults to 30 seconds&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;captureThreaddump() {&lt;br /&gt; threaddumpsDir=&amp;quot;appian_support_threaddumps/threaddumps&amp;quot;&lt;br /&gt; mkdir -p ${threaddumpsDir}&lt;br /&gt; jstack -l $pid &amp;gt; appian_support_server_metrics/threaddumps/threaddump.$pid.$(date -u +&amp;quot;%H_%M_%S&amp;quot;)&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;captureTopOutputAppServer() {&lt;br /&gt; top_app_serverDir=&amp;quot;appian_support_threaddumps/top_app_server&amp;quot;&lt;br /&gt; mkdir -p ${top_app_serverDir}&lt;br /&gt; top -Hbn1 -p $pid &amp;gt; appian_support_server_metrics/top_app_server/top_app_server.$pid.$(date -u +&amp;quot;%H_%M_%S&amp;quot;)&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;main() {&lt;br /&gt; while true&lt;br /&gt; do&lt;br /&gt; sleep $interval&lt;br /&gt; captureThreaddump&lt;br /&gt; captureTopOutputAppServer&lt;br /&gt; done&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;### Begin script execution ###&lt;br /&gt;parseArguments $*&lt;br /&gt;main&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Run the following command to add execute permissions to the file:&amp;nbsp;&lt;code&gt;chmod +x ongoing_threaddumps.sh&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Run the command using the following syntax:&lt;/li&gt;
&lt;/ol&gt;
&lt;pre&gt;./&lt;span&gt;ongoing_threaddumps&lt;/span&gt;&lt;span&gt;.sh&lt;/span&gt; &amp;lt;java_process_pid&amp;gt; &amp;lt;interval&amp;gt;&lt;/pre&gt;
&lt;p&gt;The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;&amp;lt;java_process_pid&amp;gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;parameter is the ID of the Java process for which you are collecting thread dumps. The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;&amp;lt;interval&amp;gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;parameter represents the time in seconds between each thread dump collection.&lt;/p&gt;
&lt;p&gt;Below is an example for taking&amp;nbsp;indefinite thread dumps at&amp;nbsp;10-second&amp;nbsp;intervals for the Java process with id 12345:&lt;/p&gt;
&lt;pre&gt;./&lt;span&gt;ongoing_threaddumps&lt;/span&gt;&lt;span&gt;.sh&lt;/span&gt; 12345 10&lt;/pre&gt;
&lt;p&gt;The script will create a series of thread dumps and top outputs, inside a directory named appian_support_threaddumps, in the directory in which the script exists (in this case, it will be in your home directory).&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Affected&amp;nbsp;Versions&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;This article applies to all versions of Appian.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;Last Reviewed: January 2018&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: linux, how-to, Performance, Cloud&lt;/div&gt;
</description></item><item><title>[SP-7812 DRAFT REV] INT-1479 How to create a script to generate thread dumps automatically in Linux</title><link>https://community.appian.com/support/w/kb/2688/kb-2219-how-to-create-a-script-to-generate-thread-dumps-automatically-in-linux/revision/2</link><pubDate>Thu, 11 Aug 2022 15:46:42 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d79833d9-80f6-4b34-9cfa-d53887126e08</guid><dc:creator>Elly Meng</dc:creator><comments>https://community.appian.com/support/w/kb/2688/kb-2219-how-to-create-a-script-to-generate-thread-dumps-automatically-in-linux#comments</comments><description>Revision 2 posted to Appian Knowledge Base by Elly Meng on 8/11/2022 3:46:42 PM&lt;br /&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Purpose&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;This article outlines how to create a script that can generate thread dumps automatically for a particular Java process. You can specify the number of threads and the time between each thread dump using this script.&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Instructions&lt;/span&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Create a text file named &lt;strong&gt;autothread.sh&lt;/strong&gt; in your home directory.&lt;/li&gt;
&lt;li&gt;Copy and paste the script below in the file:&lt;br /&gt;
&lt;pre&gt;#!/bin/bash&lt;br /&gt;if [ $# -eq 0 ]; then&lt;br /&gt; echo &amp;gt;&amp;amp;2 &amp;quot;Run as appian : Usage: autothread.sh &amp;lt;pid&amp;gt; [ &amp;lt;count&amp;gt; [ &amp;lt;delay&amp;gt; ] ]&amp;quot;&lt;br /&gt; echo &amp;gt;&amp;amp;2 &amp;quot; Defaults: count = 10, delay = 0.5 (seconds)&amp;quot;&lt;br /&gt; exit 1&lt;br /&gt;fi&lt;br /&gt;pid=$1 # required&lt;br /&gt;count=${2:-10} # defaults to 10 times&lt;br /&gt;delay=${3:-0.5} # defaults to 0.5 seconds&lt;br /&gt;while [ $count -gt 0 ]&lt;br /&gt;do&lt;br /&gt; top -H -b -n1 -p $pid &amp;gt;top.$pid.$(date +%H%M%S.%N) &amp;amp;&lt;br /&gt; jstack -l $pid &amp;gt;jstack.$pid.$(date +%H%M%S.%N)&lt;br /&gt; sleep $delay&lt;br /&gt; let count--&lt;br /&gt; echo -n &amp;quot;.&amp;quot;&lt;br /&gt;done&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Run the following command to add execute permissions to the file:&amp;nbsp;&lt;code&gt;chmod +x autothread.sh&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Run the command using the following syntax:&lt;/li&gt;
&lt;/ol&gt;
&lt;pre&gt;./autothread.sh &amp;lt;pid&amp;gt; [ &amp;lt;count&amp;gt; [ &amp;lt;delay&amp;gt; ] ]&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;&amp;lt;pid&amp;gt;&lt;/code&gt; parameter is the ID of the Java process for which you are collecting thread dumps. The&amp;nbsp;&lt;code&gt;&amp;lt;count&amp;gt;&lt;/code&gt; parameter represents the number of thread dumps to be collected. The &lt;code&gt;&amp;lt;delay&amp;gt;&lt;/code&gt; parameter represents the time in seconds between each thread dump collection.&lt;/p&gt;
&lt;p&gt;Below is an example for taking 5 thread dumps at 2 minute intervals for the Java process with id 12345:&lt;/p&gt;
&lt;pre&gt;./autothread.sh 12345 5 120&lt;/pre&gt;
&lt;p&gt;The script will create a series of thread dumps in the directory in which the script exists (in this case, it will be in your home directory).&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Affected&amp;nbsp;Versions&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;This article applies to all versions of Appian.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;Last Reviewed: January 2018&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: linux, how-to, Performance, Cloud&lt;/div&gt;
</description></item><item><title>INT-1479 How to create a script to generate thread dumps automatically in Linux</title><link>https://community.appian.com/support/w/kb/2688/kb-2219-how-to-create-a-script-to-generate-thread-dumps-automatically-in-linux/revision/1</link><pubDate>Thu, 11 Aug 2022 15:45:53 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d79833d9-80f6-4b34-9cfa-d53887126e08</guid><dc:creator>Elly Meng</dc:creator><comments>https://community.appian.com/support/w/kb/2688/kb-2219-how-to-create-a-script-to-generate-thread-dumps-automatically-in-linux#comments</comments><description>Revision 1 posted to Appian Knowledge Base by Elly Meng on 8/11/2022 3:45:53 PM&lt;br /&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Purpose&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;This article outlines how to create a script that can generate thread dumps automatically for a particular Java process. You can specify the number of threads and the time between each thread dump using this script.&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Instructions&lt;/span&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Create a text file named &lt;strong&gt;autothread.sh&lt;/strong&gt; in your home directory.&lt;/li&gt;
&lt;li&gt;Copy and paste the script below in the file:&lt;br /&gt;
&lt;pre&gt;#!/bin/bash&lt;br /&gt;if [ $# -eq 0 ]; then&lt;br /&gt; echo &amp;gt;&amp;amp;2 &amp;quot;Run as appian : Usage: autothread.sh &amp;lt;pid&amp;gt; [ &amp;lt;count&amp;gt; [ &amp;lt;delay&amp;gt; ] ]&amp;quot;&lt;br /&gt; echo &amp;gt;&amp;amp;2 &amp;quot; Defaults: count = 10, delay = 0.5 (seconds)&amp;quot;&lt;br /&gt; exit 1&lt;br /&gt;fi&lt;br /&gt;pid=$1 # required&lt;br /&gt;count=${2:-10} # defaults to 10 times&lt;br /&gt;delay=${3:-0.5} # defaults to 0.5 seconds&lt;br /&gt;while [ $count -gt 0 ]&lt;br /&gt;do&lt;br /&gt; top -H -b -n1 -p $pid &amp;gt;top.$pid.$(date +%H%M%S.%N) &amp;amp;&lt;br /&gt; jstack -l $pid &amp;gt;jstack.$pid.$(date +%H%M%S.%N)&lt;br /&gt; sleep $delay&lt;br /&gt; let count--&lt;br /&gt; echo -n &amp;quot;.&amp;quot;&lt;br /&gt;done&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Run the following command to add execute permissions to the file:&amp;nbsp;&lt;code&gt;chmod +x autothread.sh&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Run the command using the following syntax:&lt;/li&gt;
&lt;/ol&gt;
&lt;pre&gt;./autothread.sh &amp;lt;pid&amp;gt; [ &amp;lt;count&amp;gt; [ &amp;lt;delay&amp;gt; ] ]&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;&amp;lt;pid&amp;gt;&lt;/code&gt; parameter is the ID of the Java process for which you are collecting thread dumps. The&amp;nbsp;&lt;code&gt;&amp;lt;count&amp;gt;&lt;/code&gt; parameter represents the number of thread dumps to be collected. The &lt;code&gt;&amp;lt;delay&amp;gt;&lt;/code&gt; parameter represents the time in seconds between each thread dump collection.&lt;/p&gt;
&lt;p&gt;Below is an example for taking 5 thread dumps at 2 minute intervals for the Java process with id 12345:&lt;/p&gt;
&lt;pre&gt;./autothread.sh 12345 5 120&lt;/pre&gt;
&lt;p&gt;The script will create a series of thread dumps in the directory in which the script exists (in this case, it will be in your home directory).&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-size:inherit;"&gt;Affected&amp;nbsp;Versions&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;This article applies to all versions of Appian.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;Last Reviewed: January 2018&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: linux, how-to, Performance, Cloud&lt;/div&gt;
</description></item></channel></rss>