The revolution of Java database Connection pool--from BONECP to HIKARICP

Source: Internet
Author: User
Tags connection pooling

From BONECP to HIKARICP

Today I would like to update the BONECP version used in the project. But no intention to find Jolbox website can't open. At first thought was the wall fell, after some search, incredibly in BONECP's GitHub station saw the following paragraph:

BONECP's author did not know when to revise the brief. (PS: Part of the red box means: Although the BONECP performance is better than the old C3PO and DBCP connection pools, it should now be discarded to meet the HIKARICP)

The author's words filled with a sense of desolation, like the young knight, suave, now is the year of Twilight, had to withdraw from the lake, how desolate.

After the author's random sentiment passed, then the problem came.

HIKARICP is a shrimp?

GitHub Home: http://brettwooldridge.github.io/HikariCP/

HIKARICP is an efficient database connection pool.

  • / connection.close () .
    • in   Unconstrained  benchmark, connections > Threads.
  • One Statement Cycle is defined as single connection.preparestatement (), Statement.execute (), statement.close ().

1 VERSIONS:HIKARICP 2.1.0, BONECP 0.8.0, Tomcat 8.0.9, Vibur 1.2.0, c3p0 0.9.5-pre8, Java 8u20
2 Java Options:-server-xx:+aggressiveopts-xx:+usefastaccessormethods-xmx512m

Look at the comparison chart given from the HIKARICP website. Its performance compared to the BONECP has a qualitative change, a revolutionary change.

I am using the Spring framework. So replace the use of HIKARICP is quite simple, as long as the original BONECP configuration information to modify a bit better. See details below:

1 <!--HIKARICP High-performance database connection pool -2     <BeanID= "Datasourcehikari"class= "Com.zaxxer.hikari.HikariDataSource">3         < Propertyname= "Driverclassname"value= "Com.mysql.jdbc.Driver"/>4         < Propertyname= "Jdbcurl"value= "Jdbc:mysql://localhost:3306/black1?useunicode=true&amp;characterencoding=utf-8"/>5         < Propertyname= "username"value= "root"/>6         < Propertyname= "Password"value=""/>7         <!--Default Settings -8         <!--control autocommit Behavior Default:true -9         < Propertyname= "Autocommit"value= "true"/>Ten         <!--Connection Pool Gets whether the connection is read-only default:false - One         < Propertyname= "ReadOnly"value= "false"/> A         <!--control the transaction isolation level of the connection Default:none - -         < Propertyname= "Transactionisolation"value= "None"/> -         <!--set the catalog to support viewing catalogs, if not specified, will use the JDBC driver directly default:none - the         < Propertyname= "Catalog"value= "None"/> -         <!--Maximum connection timeout time default:30 seconds - -         < Propertyname= "ConnectionTimeout"value= "30000"/> -         <!--Maximum idle timeout time default:10 minutes - +         < Propertyname= "IdleTimeout"value= "600000"/> -         <!--Maximum lifetime of a connection in a connection pool default:30 minutes - +         < Propertyname= "Maxlifetime"value= "1800000"/> A         <!--  ... There are some other configuration properties that are interesting to see O (∩_∩) o haha ~ - at     </Bean>

Ps: The author is also the first to use the HIKARICP class library. The specific performance and advantages of the temporary is not a good conclusion. But believe that the HIKARICP Development group can publish such a contrast chart, want to think is not groundless, temporarily use, over time to improve performance is shown in the table. Continued attention.

HIKARICP Some of the official web tutorial documents: Https://github.com/brettwooldridge/HikariCP/wiki

Maven:

"JDK1.8"

1 <Dependency>2     <groupId>Com.zaxxer</groupId>3     <Artifactid>Hikaricp</Artifactid>4     <version>2.1.0</version>5     <Scope>Compile</Scope>6 </Dependency>

"JDK1.6 and 1.7":

1 <Dependency>2     <groupId>Com.zaxxer</groupId>3     <Artifactid>Hikaricp-java6</Artifactid>4     <version>2.1.0</version>5     <Scope>Compile</Scope>6 </Dependency>


Author
:tinyz
Source:http://www.cnblogs.com/zou90512/
About engaging in web game server development (JAVA). Like to contact and understand new technologies. Improve your own value by constantly exploring and learning. Record experience sharing.
This article is copyrighted by the author and the blog Park, welcome reprint, but without the consent of the author must retain this statement, and in the article page obvious location to give the original link
If you have any questions, you can contact me by [email protected] , thank you very much.
Author shop: http://aoleitaisen.taobao.com. Welcome to the crowd

 

Revolution in Java database connection pooling-from BONECP to HIKARICP

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.