1, 配置參數可以加上 增加參數,-XX:-UseGCOverheadLimit
2, mysql connection 版本如果小於5.1.10 有個內存bug
3,c3p0 連接池等數據庫連接池,如果程序內部沒處理好, 可能會出現連接一直存在,最後連接不夠, 可以用開源的阿里巴巴 mysql連接 Druid, 設置removeAbandoned=true,removeAbandonedTimeout=600(10分鐘),
Druid可能是現在最好的數據庫連接池~~~
4,HttpClient (Apache的4.x及以上)要正確關閉get/post,和entity
HttpResponse resp = null;
try {
resp = client.execute(httpGet);
if (resp.getStatusLine().getStatusCode() == 200) {
isPostBackSucc = true;
}
} catch (Throwable e) {
logger.error("error", e);
} finally {
try {
httpGet.abort();//這裏要調用
} catch (Exception e) {
}
if (resp != null) {
try {
EntityUtils.consumeQuietly(resp.getEntity());//這裏要關閉
} catch (Exception e) {
}
}
}