【正文】
here the garbage collections are occurring more and more frequently, with less memory being freed.收集日志:生成HEAP DUMP 分析工具:(IBM Support Assistant)Memory Dump Diagnostic for Java (MDD4J)應(yīng)對(duì)策略:標(biāo)記那些不再使用的對(duì)象為NULL,從根本上去杜絕或避免內(nèi)存泄漏的發(fā)生?;蛘哒{(diào)整參數(shù),設(shè)置大對(duì)象區(qū)域。(3)自己申請(qǐng)數(shù)據(jù)庫(kù)連接,自己處理事務(wù),自己釋放連接。(2)嚴(yán)格避免自己去申請(qǐng)數(shù)據(jù)庫(kù)連接,自己處理數(shù)據(jù)庫(kù)SQL語(yǔ)句。Applications can suffer from performance problems and even appear to “hang” if they do not close their connections properly. This is most often caused by developers not properly using the () method. To ensure that connections will be closed properly, they should be closed in a “finally{}” block. WebSphere Application Server is instrumented to eventually timeout orphaned connections and return them to the pool, but for an application that makes frequent use of database connections, this might not be enough. New connections can get queued up waiting for the database while old connections are waiting to be timed out. This can bring the application grinding to a halt, and you can see connectionWaitTimeoutExceptions. When using a connection pool, it is important to follow specific programming practices to make connection pooling work most efficiently and to prevent problems. One of the most important practices is to always call close() on a connection object as soon as the application finishes using it. This is necessary so that the connection can return to the free connection pool. Care should be taken to make sure connections are closed even in exception condition. Failing to close connections means that connections are leaked, reducing the number of connections available in the connection pool, and leading to ConnectionWaitTimeoutExceptions. 收集日志:To enable connection leak diagnostics, set the Log Detail Level to “ConnLeakLogic=finest” and enable diagnostic tracing. 分析工具:Tivoli Performance Viewer應(yīng)對(duì)策略:找到連接沒(méi)有關(guān)閉的地方,將其關(guān)閉。所以說(shuō),如果有很多長(zhǎng)時(shí)間的SERVLET/JSP,應(yīng)該排隊(duì)挨個(gè)處理?;蛘咴黾幼畲髷?shù)據(jù)庫(kù)連接數(shù)。應(yīng)對(duì)策略:增加最大的數(shù)據(jù)庫(kù)連接數(shù),或者調(diào)整程序,不要使用此種模