1
有證據顯示受WebLogic標誌着阻塞線程日誌:如何計算weblogic中卡住的線程?
<Apr 23, 2013 7:48:25 AM CST> <Error> <WebLogicServer> <BEA-000337> <[STUCK] ExecuteThread: '276' for queue: 'weblogic.kernel.Default (self-tuning)' has been busy for "668" seconds working on the request "[email protected][
GET /XXX/saveInfo.do?fx=duration&info=25159,0,0,0,0,0,0,25153 HTTP/1.1
在我的情況下,我們觀察到,如果有太多的阻塞線程,我們的服務器會越來越慢的響應時間,吃越來越多的內存。
我想讓卡住的線程數成爲我的自動報告機器人的健康指數。如何計算日誌文件以外的內容?任何命令或API都能幫助我計算卡住的線程嗎?
從@viccari總結溶液(WLST示例代碼):
from tempfile import mktemp
connect('your_account', 'your_account_pass', 'localhost:7001')
# dump thread details to a temp file
file = mktemp()
threadDump(writeToFile="true", serverName="your_server_name", fileName=file)
# count the string token "[STUCK]" by line
count = 0
f = open(file, "r")
for line in f.readlines():
if line.find("STUCK") > 0:
count = count + 1
print "NUM_OF_STUCK_THREADS: ", count