Java Database connection Pool performance comparison

Source: Internet
Author: User
Tags jboss xeon e5

The purpose of this test is to verify the performance of the current common database connection pool.

TestCase
  Connection conn = dataSource.getConnection();  PreparedStatement stmt = conn.preparedStatement("select 1");  ResultSet rs = stmt.executeQuery();  while (rs.next()) {  }  rs.close();  stmt.close();  conn.close();
    • Test Codehttps://github.com/alibaba/druid/blob/master/src/test/java/com/alibaba/druid/benckmark/pool/case1.java

    • Test Config

      Property Value
      InitialSize 10
      Minpoolsize 10
      Maxpoolsize 50

Test the performance comparison of 1,000,000 (1 million) times of the total time spent executing requests in various concurrent scenarios.

Environment
    • OS Linux 3.5.0-19-generic x86_64
    • CPU XEON e5-2450 Dual Total 16 core 32 physical thread
    • Memory 48G

This is a two-way Xeon CPU workstation, which is closer to the real server environment than the one I tested on Mac book Pro.

JDK 1.6.0_38
Database Connection Pool 1 thread 2 Threads 5 Threads Ten Threads Threads Threads Threads
Druid 248 710 1,133 1,134 905 1,107 1,468
Dbcp 660 1,522 3,545 4,176 3,671 4,237 14,129
Bonecp 3,522 2,930 2,579 3,745 7,434 11,991 14,584
C3p0 4,275 9,509 3,371 10,439 13,472 19,848 36,153
Proxool 7,187 7,707 11,037 10,777 15,222 (Error) 18,100 (Error) 21,547 (Error)
Tomcat-jdbc 372 736 1,879 1,727 1,576 1,322 12,545
Jboss-datasource 1,326 1,184 2,928 3,765 3,099 3,278 10,812
JDK 1.7.0_10
Database Connection Pool 1 thread 2 Threads 5 Threads Ten Threads Threads Threads Threads
Druid 309 605 1,028 947 962 897 1,238
Dbcp 924 1,461 4,062 4,030 4,908 5,505 14,517
Bonecp 3,047 2,055 2,549 3,821 6,367 12,865 18,832
C3p0 4,018 8,206 8,897 10,667 12,367 25,822 38,681
Proxool 6912 4,714 4,851 11,908 16,066 (Error) 19,568 (Error) 18,036 (Error)
Tomcat-jdbc 400 740 1,811 1,707 1,618 1,624 11,905
Jboss-datasource 1,369 1,105 4,002 3,089 3,483 3,665 11,782
Results analysis
    1. Druid is the best-performing database connection pool, with TOMCAT-JDBC and Druid performance approaching.
    2. Proxool in the intense concurrency will throw abnormal, completely not reliable. In the case of concurrency 10, 11 or 12 physical connections are used.
    3. C3P0 and Proxool are fairly slow and slow to the point where SQL execution is inefficient.
    4. BONECP performance is not superior, the use of linkedtransferqueue has not been able to achieve performance gains.
    5. Jboss-datasource stable, but poor performance
    6. BONECP and c3p0 completely do not follow the minpoolsize configuration, as long as there is an activity request, it will use the maxpoolsize.
    7. BONECP and C3P0 have large concurrent use of more than maxpoolsize number of physical connections, reaching maxpoolsize+1

Transferred from: Https://github.com/alibaba/druid/wiki/linux-benchmark

Related Article

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.