背景
公司的產(chǎn)品一直使用的是DBCP作為連接池。但是最近在客戶環(huán)境發(fā)現(xiàn)當(dāng)并發(fā)增加時(shí),宕機(jī)鳥。已經(jīng)對數(shù)據(jù)庫查詢進(jìn)行了優(yōu)化,但是還是會發(fā)生Tomcat宕機(jī)的情況,想到更換數(shù)據(jù)庫連接池。
But換或者不換都要有數(shù)據(jù)佐證嘍。因此著手測試對比。
測試環(huán)境
應(yīng)用服務(wù)器 | Tomcat 5.5 |
測試工具 | JMete 2.8 |
數(shù)據(jù)庫 | Oracle 11g |
DBCP & Proxool
測試場景:系統(tǒng)登錄(一次登錄操作需要>14次的數(shù)據(jù)庫連接操作)
測試結(jié)果(20秒內(nèi)模擬50個(gè)進(jìn)程循環(huán)3次)
DBCP
sampler_label | aggregate_report_count | average | aggregate_report_median | aggregate_report_90%_line | aggregate_report_min | aggregate_report_max | aggregate_report_rate | aggregate_report_bandwidth |
login:HTTP請求 | 150 | 6906 | 6262 | 13137 | 461 | 16022 | 3.071505 | 1.643735 |
總體 | 150 | 6906 | 6262 | 13137 | 461 | 16022 | 3.071505 | 1.643735 |
proxool
sampler_label | aggregate_report_count | average | aggregate_report_median | aggregate_report_90%_line | aggregate_report_min | aggregate_report_max | aggregate_report_rate | aggregate_report_bandwidth |
login:HTTP請求 | 150 | 2959 | 3165 | 4620 | 8 | 5522 | 4.797083 | 5.380354 |
總體 | 150 | 2959 | 3165 | 4620 | 8 | 5522 | 4.797083 | 5.380354 |
結(jié)論
1. 從以上測試結(jié)果看,proxool的性能明顯優(yōu)于DBCP。
2. 另外針對Tomcat 5.5和Tomcat 6.0也做了測試,發(fā)現(xiàn)Tomcat不同版本間的差異并不大,因此決定暫時(shí)不更換應(yīng)用服務(wù)器。
下一步
利用jrockit分析系統(tǒng)內(nèi)存泄露情況,進(jìn)行改進(jìn)。