bonecp速度测试

测试版本

[quote]bonecp-0.7.1-rc2.jar
bonecp-provider-0.7.1-rc2.jar
guava-r08.jar
guava-r08-gwt.jar
mysql-connector-java-3.0.17-ga-bin.jar[/quote]


[b]未使用bonecp的AB测试效果[/b]



<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url"
value="jdbc:mysql://localhost/s?useUnicode=true&characterEncoding=utf-8"
/> <property name="username"> <value>root</value> </property>
<property name="password"> <value></value> </property>
</bean>




[quote]

C:\Documents and Settings\Administrator>ab -n 1000 -c 10 http://www.abc.com/?refresh=true
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking www.abc.com (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests


Server Software: Apache-Coyote/1.1
Server Hostname: www.abc.com
Server Port: 80

Document Path: /?refresh=true
Document Length: 20385 bytes

Concurrency Level: 10
Time taken for tests: 193.406 seconds
Complete requests: 1000
[color=red]Failed requests: 503
(Connect: 0, Receive: 0, Length: 503, Exceptions: 0) 请求失败。[/color]
Write errors: 0
Non-2xx responses: 503
Total transferred: 10479297 bytes
HTML transferred: 10131345 bytes
[color=red]Requests per second: 5.17 [#/sec] (mean)
Time per request: 1934.063 [ms] (mean) [/color]
Time per request: 193.406 [ms] (mean, across all concurrent requests)
Transfer rate: 52.91 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 4.3 0 31
Processing: 94 1906 1426.7 2000 8234
Waiting: 94 1893 1428.6 1984 8234
Total: 94 1907 1426.2 2000 8234

Percentage of the requests served within a certain time (ms)
50% 2000
66% 2031
75% 3000
80% 3016
90% 4016
95% 5016
98% 6031
99% 6063
100% 8234 (longest request)
[/quote]


[b]使用bonecp后的AB测试效果[/b]


<bean id="dataSource"
class="org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy">
<property name="targetDataSource">
<ref local="mainDataSource" />
</property>
</bean>

<bean id="mainDataSource" class="com.jolbox.bonecp.BoneCPDataSource"
destroy-method="close">
<property name="driverClass" value="com.mysql.jdbc.Driver" />
<property name="jdbcUrl"
value="jdbc:mysql://localhost/ssss?useUnicode=true&characterEncoding=utf-8" />
<property name="username" value="root" />
<property name="password" value="" />
<property name="idleConnectionTestPeriod" value="60" />
<property name="idleMaxAge" value="240" />
<property name="maxConnectionsPerPartition" value="60" />
<property name="minConnectionsPerPartition" value="20" />
<property name="partitionCount" value="3" />
<property name="acquireIncrement" value="10" />
<property name="statementsCacheSize" value="50" />
<property name="releaseHelperThreads" value="3" />
</bean>



[quote]

C:\Documents and Settings\Administrator>ab -n 1000 -c 10 http://www.abc.com/?refresh=true

This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking www.abc.com (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests


Server Software: Apache-Coyote/1.1
Server Hostname: www.abc.com
Server Port: 80

Document Path: /?refresh=true
Document Length: 20385 bytes

Concurrency Level: 10
Time taken for tests: 12.313 seconds
[color=red]Complete requests: 1000
Failed requests: 0 未失败。其实是存在失败的。[/color]
Write errors: 0
Total transferred: 20741000 bytes
HTML transferred: 20385000 bytes
[color=red]Requests per second: 81.22 [#/sec] (mean)
Time per request: 123.125 [ms] (mean)[/color]
Time per request: 12.313 [ms] (mean, across all concurrent requests)
Transfer rate: 1645.07 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 4.9 0 31
Processing: 16 121 55.6 109 453
Waiting: 16 90 59.3 78 406
Total: 16 122 55.7 125 453

Percentage of the requests served within a certain time (ms)
50% 125
66% 125
75% 141
80% 141
90% 172
95% 234
98% 313
99% 344
100% 453 (longest request)

[/quote]


后端报错。mysql为默认设置
[quote]

2011-3-30 0:26:12 com.jolbox.bonecp.PoolWatchThread fillConnections
严重: Error in trying to obtain a connection. Retrying in 7000ms
java.sql.SQLException: Data source rejected establishment of connection message from server: "Too many connections"
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2001)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1907)
at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:2524)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:818)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1808)
at com.mysql.jdbc.Connection.<init>(Connection.java:452)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:411)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at com.jolbox.bonecp.BoneCP.obtainRawInternalConnection(BoneCP.java:242)
at com.jolbox.bonecp.ConnectionHandle.obtainInternalConnection(ConnectionHandle.java:204)
at com.jolbox.bonecp.ConnectionHandle.<init>(ConnectionHandle.java:161)
at com.jolbox.bonecp.PoolWatchThread.fillConnections(PoolWatchThread.java:101)
at com.jolbox.bonecp.PoolWatchThread.run(PoolWatchThread.java:82)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)

[/quote]


[b]容量提升 81.22/5.17=15.7 倍。[/b]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值