`
wutao8818
  • 浏览: 618191 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

bonecp速度测试

阅读更多
测试版本

引用
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



未使用bonecp的AB测试效果


<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&amp;characterEncoding=utf-8"
		/> <property name="username"> <value>root</value> </property>
		<property name="password"> <value></value> </property>
		</bean>




引用


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
Failed requests:        503
   (Connect: 0, Receive: 0, Length: 503, Exceptions: 0)  请求失败。

Write errors:           0
Non-2xx responses:      503
Total transferred:      10479297 bytes
HTML transferred:       10131345 bytes
Requests per second:    5.17 [#/sec] (mean)
Time per request:       1934.063 [ms] (mean)

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)





使用bonecp后的AB测试效果

<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&amp;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>




引用


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
Complete requests:      1000
Failed requests:        0  未失败。其实是存在失败的。

Write errors:           0
Total transferred:      20741000 bytes
HTML transferred:       20385000 bytes
Requests per second:    81.22 [#/sec] (mean)
Time per request:       123.125 [ms] (mean)

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)




后端报错。mysql为默认设置
引用


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)




容量提升 81.22/5.17=15.7 倍。






分享到:
评论

相关推荐

    bonecp连接池

    #测试连接有效性的间隔时间,单位分钟 bonecp.idleConnectionTestPeriod = 60 #连接的空闲存活时间,当连接空闲时间大于该阀值时,清除该连接 bonecp.idleMaxAge = 240 #语句缓存个数,默认是0 bonecp....

    BoneCP连接池和Ehcache注解缓存整合到Spring

    5. **测试验证**:编写测试用例,确保 BoneCP 能够正常提供数据库连接,Ehcache 的缓存功能也能正常工作。 这样的整合可以大大提高应用的响应速度,同时降低了数据库的负载。在实际项目中,还需要根据业务需求和...

    开源数据库连接池bonecp附教程

    骨CP是Jeffrey Li创建的一个数据库连接池实现,它的设计目标是在保持高性能的同时,降低内存占用,从而提高应用的响应速度。骨CP的核心特性包括线程安全的连接分配和自动回收,以及基于池化的数据库连接管理。 二、...

    比c3p0还快的bonecp连接池配置方法讲解

    在某些测试中,BoneCP被证明比C3P0快约25倍,这使得它成为在高并发场景下优化数据库性能的优秀选择。本文将详细介绍如何配置 BoneCP 连接池,以及对比C3P0的配置方法。 1. **BoneCP的基本概念与优势** - BoneCP 是...

    Spring3中配置DBCP,C3P0,Proxool,Bonecp数据源

    如Bonecp目前听说是最快的数据源,速度是传统的c3p0的25倍, bonecp.properties文件: bonecp.driverClass=org.gjt.mm.mysql.Driver bonecp.jdbcUrl=jdbc:mysql://localhost/manytomany?useUnicode=true&amp;...

    bonecp详细配置

    ### BoneCP 详细配置 BoneCP(Bone Connection Pool)是一个高效、开源的Java数据库连接池实现,它在处理高并发连接请求方面表现出色。本文将详细介绍BoneCP的主要配置参数及其默认值,帮助开发者更好地理解和使用...

    bonecp-0.6.5-rc3.zip

    BoneCP的设计目标就是最小化这个开销,从而提升系统的响应速度和并发处理能力。 BoneCP 0.6.5-rc3是其一个重要的版本,"rc3"代表Release Candidate 3,即候选发布版本3,意味着这个版本在经过多次测试和优化后,...

    BoneCp整合

    BoneCP是一个轻量级、高性能的数据库连接池,它提供了线程安全的连接管理,可以有效地减少数据库连接创建和销毁的开销,从而提高应用的并发处理能力和响应速度。同时,将BoneCP与Hibernate和Spring整合,可以实现...

    java数据库连接方法.pdf

    BoneCP以其高效的连接管理和速度著称。 每种连接池都有自己的配置参数,如最小连接数、最大连接数、超时时间等,可以配置在XML文件中或通过代码硬编码。例如,配置C3P0连接池可能涉及以下参数: ```properties c3p...

    几种数据库连接池详细配置

    本文将深入解析几种常用的数据库连接池——Apache DBCP、C3P0、Proxool、BoneCP的详细配置参数,帮助开发者更好地理解和应用这些技术。 ### Apache DBCP **dataSource**: 配置数据源,通常在应用服务器的配置文件...

    jdbc连接池

    它允许开发者在不频繁创建和销毁数据库连接的情况下,有效地复用已存在的连接,从而减少系统开销,提高应用程序的响应速度。 标题中的“jdbc连接池”指的是利用JDBC接口实现的数据库连接池机制。数据库连接池是应用...

    spring-boot 笔记

    使用Spring Boot对传统购物车系统进行改造的过程中,可以采用其自动配置的能力,减少大量的配置工作,并利用其内置的服务器支持快速部署和测试应用。Spring Boot提供了大量的自动配置模块,可以自动配置Spring以及第...

    springboot课堂笔记,如果觉得好给我留言要教学视频

    - **版本迭代快**:Spring Boot 的版本迭代速度较快,可能需要频繁更新。 #### 六、Spring Boot 全局配置 **自定义 Banner**: 1. **创建 banner.txt 文件**:在项目的 `resources` 目录下创建。 2. **设计 Banner...

Global site tag (gtag.js) - Google Analytics