Java数据库连接池 BoneCP
<div class="detail" id="p_fullcontent" style=""><p>BoneCP 是一个开源的快速的 JDBC 连接池。BoneCP很小,只有四十几K(运行时需要<a href="http://www.oschina.net/p/log4j" rel="noopener nofollow">log4j</a>和<a href="http://www.oschina.net/p/google+collections" rel="noopener nofollow">Google Collections</a>的支持,这二者加起来就不小了),而相比之下 <a href="http://www.oschina.net/p/c3p0" rel="noopener nofollow">C3P0</a> 要六百多K。另外个人觉得 BoneCP 有个缺点是,JDBC驱动的加载是在连接池之外的,这样在一些应用服务器的配置上就不够灵活。</p>
当然,体积小并不是 BoneCP 优秀的原因,BoneCP 到底有什么突出的地方呢,请看看下面的性能测试报告:
Single Thread
- 1,000,000 get connection / release connection requests
- No delay between getting/releasing connection.
- Pool size range: 20-50.
- Acquire increment: 5
- Helper threads: 1
- Partition count: 1
Multi-Thread
- 500 threads each attempting 100 get/release connection
- No delay between getting/releasing connection.
- Pool size range: 50-200.
- Acquire increment: 5
- Helper threads: 5
Multi-Thread 10ms delay
- 500 threads each attempting 100 get/release connection
- We introduce a 10ms delay (Thread.sleep()) between the acquire connection and the release connection to simulate work being done with the connection.
- Pool size range: 50-200.
- Acquire increment: 5
- Helper threads: 5
Multi-Thread 25ms delay
- 500 threads each attempting 100 get/release connection
- We introduce a 25ms delay (Thread.sleep()) between the acquire connection and the release connection to simulate work being done with the connection.
- Pool size range: 50-200.
- Acquire increment: 5
- Helper threads: 5
Multi-Thread 50ms delay
- 500 threads each attempting 100 get/release connection
- We introduce a 50ms delay (Thread.sleep()) between the acquire connection and the release connection to simulate work being done with the connection.
- Pool size range: 50-200.
- Acquire increment: 5
- Helper threads: 5
Multi-Thread 75ms delay
- 500 threads each attempting 100 get/release connection
- We introduce a 75ms delay (Thread.sleep()) between the acquire connection and the release connection to simulate work being done with the connection.
- Pool size range: 50-200.
- Acquire increment: 5
- Helper threads: 5
Prepared Statement (single threaded)
- Fetches a single connection then calls 1,000,000 connection.prepareStatement(...) followed by an immediate statement close.
- No delay between calls
- Max statements: 30
- Max statements per connection: 30
- Helper threads: 5
Prepared Statement (multi-threaded)
- 500 Threads each attempting 100 get/release connection with no delays. After obtaining a connection, make a call to connection.prepareStatement(...) followed by a close statement request.
- No delay between calls
- Pool size range: 50-200.
- Acquire increment: 5.
- Helper threads: 5
Prepared Statement (multi-threaded, 10ms delay)
- 500 Threads each attempting 100 get/release connection with no delays. After obtaining a connection, make a call to connection.prepareStatement(...) followed by a close statement request.
- 10ms delay between open connection/release connection to simulate work done by the application.
- Pool size range: 50-200.
- Acquire increment: 5.
- Helper threads: 5
Prepared Statement (multi-threaded, 25ms delay)
- 500 Threads each attempting 100 get/release connection with no delays. After obtaining a connection, make a call to connection.prepareStatement(...) followed by a close statement request.
- 25ms delay between open connection/release connection to simulate work done by the application.
- Pool size range: 50-200.
- Acquire increment: 5.
- Helper threads: 5
Prepared Statement (multi-threaded, 50ms delay)
- 500 Threads each attempting 100 get/release connection with no delays. After obtaining a connection, make a call to connection.prepareStatement(...) followed by a close statement request.
- 50ms delay between open connection/release connection to simulate work done by the application.
- Pool size range: 50-200.
- Acquire increment: 5.
- Helper threads: 5
Prepared Statement (multi-threaded, 75ms delay)
- 500 Threads each attempting 100 get/release connection with no delays. After obtaining a connection, make a call to connection.prepareStatement(...) followed by a close statement request.
- 75ms delay between open connection/release connection to simulate work done by the application.
- Pool size range: 50-200.
- Acquire increment: 5.
- Helper threads: 5
<ul class="attrs">
<li>授权协议: <a title="license: LGPL">LGPL</a></li>
<li class="lang">开发语言: <a href="/project/lang/19/java" rel="noopener nofollow">Java</a> </li>
<li>操作系统:
<a>跨平台</a> </li>
<li>软件主页: <a href="http://jolbox.com/" target="_blank" class="thumbnail_enable" rel="noopener nofollow">http://jolbox.com/</a></li>
<li>文档地址: <a href="http://jolbox.com/configuration.html" target="_blank" rel="noopener nofollow">http://jolbox.com/configuration.html</a></li>
<li>下载地址: <a href="http://jolbox.com/download.html" target="_blank" rel="noopener nofollow">http://jolbox.com/download.html</a></li>
<li>收录时间: <a>2009年11月28日</a></li>
</ul>
</div>