Skip to content

AEM – Thread Dumps Analysis

DISCLAIMER:

If you require any more information or have any questions about our site’s disclaimer, please feel free to contact us by email at [email protected]

All the information on this website – https://skydevops.co.in – is published in good faith and for general information purpose only. SKYDEVOPS does not make any warranties about the completeness, reliability and accuracy of this information. Any action you take upon the information you find on this website (skydevops), is strictly at your own risk.
SKYDEVOPS will not be liable for any losses and/or damages in connection with the use of our website.

From our website, you can visit other websites by following hyperlinks to such external sites. While we strive to provide only quality links to useful and ethical websites, we have no control over the content and nature of these sites. These links to other websites do not imply a recommendation for all the content found on these sites. Site owners and content may change without notice and may occur before we have the opportunity to remove a link which may have gone ‘bad’.

Please be also aware that when you leave our website, other sites may have different privacy policies and terms which are beyond our control. Please be sure to check the Privacy Policies of these sites as well as their “Terms of Service” before engaging in any business or uploading any information.

CONSENT:

By using our website, you hereby consent to our disclaimer and agree to its terms.

UPDATE:

Should we update, amend or make any changes to this document, those changes will be prominently posted here.

-== & ==-

REFERENCE LINKS:

SYNOPSIS:

  • A customized powershell script to download/generate the thread dumps
  • Using fastthread to analyse the dumps
  • Using fastthread API to get the response in JSON format
  • Extracting the thread dump report URL from the JSON and access the report
  • Use the Thread Dump Collection & Analysis tool [jstack] to take thread dumps from a running CQ instance for troubleshooting the following:
    • Performance
    • Lock contention.
    • Dead lock
    • other thread-related issues

ASSUMPTION:

  • Assuming that service name is AEM
  • cURL is already installed and configured on windows
  • Has Administrator access
  • Already have API access to fastthread, if not register at FastThread API

GUIDE:

  • Powershell Script to generate thread dumps, upload to fastthread using cURL or API endpoint, and get JSON response.
  • Following is the report generated on Fast Thread


# stopping the job if it encounters error
$ErrorActionPreference = 'Stop'
$WarningPreference = 'SilentlyContinue'

# Parameters
$AEMSRC = (get-wmiobject win32_service | ?{$_.Name -eq 'AEM'})
$AEMPID = $AEMSRC.ProcessID
$CURLEXE = "C:toolscurl76bincurl.exe"
$FILENAME = "tdaem64.txt"

# Generating ThreadDumps
cmd.exe /c "jstack -l $AEMPID > $FILENAME"
# Fastthread API
$REPURL = "http://api.fastthread.io/fastthread-api?apiKey={xxxx-xxxx-xxxx-xxxxxx-xxxxxxxxxx}"
# ThreadDumps output file
$DATA = "@$FILENAME"
# Generating threaddumps Report in JSON format
$REPDATA = cmd.exe /c "curl -X POST --data-binary @./$FILENAME $REPURL --header Content-Type:text" | ConvertFrom-Json
# Extracting the ThreadDump report URL from JSON output
$REPORTURL = $REPDATA.graphURL

# Email the Report URL
Write-Host "Emailing the ThreadDump Report"
Send-MailMessage -SmtpServer smtp.gmail.com `
-Port 587 `
-Credential $cred `
-UseSsl `
-From '[email protected]' `
-To '[email protected]' `
-Subject "ThreadDump Report" `
-Body "The ThreadDump Report can be viewed at $REPORTURL"
Write-Host "Email Sent."

# Clean Up
Remove-Item -Path $FILENAME

# Open the ThreadDump Report in Chrome Browser
Start-Process "chrome.exe" $REPORTURL


01
02
03
04
05
06
07
08

Shashi View All

A passionate devops and automation engineer

Leave a comment