was宕机常见问题及参考解决方案

was宕机常见问题及参考解决方案

ID:9302553

大小:52.00 KB

页数:6页

时间:2018-04-27

was宕机常见问题及参考解决方案_第1页
was宕机常见问题及参考解决方案_第2页
was宕机常见问题及参考解决方案_第3页
was宕机常见问题及参考解决方案_第4页
was宕机常见问题及参考解决方案_第5页
资源描述:

《was宕机常见问题及参考解决方案》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、WAS宕机问题总结起来有以下几类:一、线程挂起导致线程池满(ThreadHang):HangsrefertotheJVMlockinguporrefusingtorespond.Ahangcanoccurwhen:1)Yourapplicationenteredanwaitleak2)ExcessiveSynchronizationcauseperformanceproblems3)Adeadlockhasoccurred收集日志:生成JAVACORE分析工具:IBMThreadandMonitorDumpAnalyzer1、线程等待泄漏(W

2、aitLeaks)常见的情况就是,有很多线程使用wait()方法,等待被唤醒notify()。但是,存在某一个线程获取到锁并且进行业务处理完成后,忘记去唤醒等待执行的进程。这样导致的等待泄漏,从而线程挂起。Whenyouusethewait/notifymechanism,youtypicallyhaveoneormorethreadsblockedinthewait()call,waitingtobenotified.Thenotifyingthreadissupposedtocallnotify()ornotifyAll()tosigna

3、lthatwaitingthreadscanwakeupandcarryonprocessing.Aproblmaticsituationcouldoccurthatthenotify()callisinvokedbeforethethreadsgointothewait()method.Inthiscase,thewaitingthreadswouldnotbenotifiedanymoreandbecomestuck.So,donotforgettonotifythewaitingtheadsinyouapplicationandmaks

4、surethattheNotifyactionisperformedafterallthewaitingthreadsarestarted.应对策略:notify必须发生在所有wait之前。2、同步过度(ExcessiveSynchronization)LIS系统FORMULAONE报表打印就是采用了SYNCHRONIZE思想,如果有某一个大的报表长时间打不出来的话,会导致其它所有的报表打印线程全部挂起。Synchronizationisrequiredforprotectingsomecriticalresources,butiflarge

5、sectionsofcodearesynchronized,anapplicationeffectivelywillbecomesinglethreaded,andthethroughputwilldecreasedramatically.Toimprovetheperformance,youshouldthinkabout:1)Useotherefficientalgorithmtoreplacethemonitor/lock?2)Trytokeepthemonitorlockforashorttime?3)Reducethenumbero

6、fthreadsusingthismonitor/lock?应对策略:改变程序实现算法,避免占用锁时间过长。比如设置多个锁或者提高同步代码块的执行效率。3、资源抢占死锁(DeadLock)线程运行需要获取到两个资源,当线程1获取到资源A,线程2获取到资源B,此时,线程1需要再获取资源B,线程2需要再获取资源A。这就形成了资源循环申请的一个死锁。其它想获取到资源A或者资源B的线程必将都会挂起。Inthiscase,athreadacquiresthelockonlock1,Atthesametime,anotherthreadacquirest

7、helockonlock2.sothethreadsaredeadlocked:neitherthreadwillgiveupitslockuntilitacquirestheotherlock,butneitherwillbeabletoacquiretheotherlockuntiltheotherthreadgivesitup.Oneofthebestwaystopreventthepotentialfordeadlockistoavoidacquiringmorethanonelockatatime,whichisoftenpract

8、ical.However,ifthatisnotpossible,youneedastrategythatensuresyouacquiremultiplelock

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。