Comparison of open source connection pools for DBCP, c3p0, Proxool, BONECP

Source: Internet
Author: User
Tags connection pooling

Brief introduction Usage evaluation Project Home
 dbcp

DBCP is a database connection pool that relies on the Jakarta Commons-pool object pooling mechanism. DBCP can be used directly in the application using

 

can set maximum and minimum connections, connection wait time, etc., basic functions, The continued stability of this connection pool is still possible, but at a slightly slower rate, stability decreases under the pressure of large concurrency and does not provide connection pool monitoring

 

http://homepages.nildram.

co.uk/~slink/java/ dbpool/

 c3p0  C3P0 is an open source JDBC connection pool, which is published in the Lib directory with Hibernate, including statement objects that implement the connection and datasources pools of JDBC3 and JDBC2 extension specification descriptions.

Connection pool can be set maximum and minimum connection, connection wait time, etc., basic functions are, the continuous operation of the connection pool stability is quite good, under the pressure of large concurrency is also guaranteed, but also does not provide connection pool monitoring.

http://sourceforge.net/projects/c3p0

 proxool   This is a Java SQL driver driver that provides a connection pooling package for other types of drivers that you choose. Can be ported to existing code very simply. Fully configurable. Fast, mature and robust. You can transparently increase the connection pooling capability for your existing JDBC driver.   connection pool can set maximum and minimum connections, connection wait time, etc. Basic functionality, the stability of the continuous operation of the connection pool has some problems, there is an advantage--connection pool monitoring  http://proxool.sourceforge.net/
Bonecp BONECP is a fast, open source database connection pool. Help you manage your data connections to give your application faster access to the database. 25 times times faster than the C3P0/DBCP connection pool A new data connection technology, known for its high efficiency, fast speed, connection pool can set maximum and minimum connection, connection waiting time, etc., basic functions have

Http://jolbox.com/about.html

 
Parameter description
DBCP
C 3 P 0 Acquireincrement: c3p0 The number of connections fetched at a time when the connection in the connection pool is exhausted. Default:3
Acquireretryattempts: Defines the number of repeated attempts to obtain a new connection from the database after a failure. Default:30
Acquireretrydelay: Interval in two connections, per millisecond. default:1000
Autocommitonclose: All uncommitted operations are rolled back by default when the connection is closed. Defaul T:false
AUTOMATICTESTTABLE:C3P0 will build an empty table named Test and test it with its own query statement. If this parameter is defined, then the attribute preferredtestquery will be ignored. You cannot do anything on this test sheet, it will be used only for C3P0 testing. Default:null
Breakafteracquirefailure: Getting a connection failure will cause any thread that waits for the connection pool to get the connection to throw an exception. However, the data source is still valid and continues to try to get the connection the next time you call Getconnection (). If set to True, the data source will declare broken and permanently shut down after attempting to acquire a connection failure. Default:false
Checkouttimeout: When the connection pool is exhausted, the client calls getconnection () to wait for a new connection, and then throws SqlException after the timeout, and waits indefinitely if set to 0. Unit milliseconds. default:0
Connectiontesterclassname: Test the connection by implementing a class of Connectiontester or Queryconnectiont ester. The class name needs to be set to the full path. Default:com.mchange.v2.c3p0.impl.Def Aultconnectiontester
Factoryclasslocation: Specifies the path of the C3P0 libraries, which is not required if (usually it is) local, and defaults to NULL for Default:null
Idleconnectiontestperiod: Checks for idle connections in all connection pools every 60 seconds. Defaul t:0
Initialpoolsize: Gets three connections during initialization, and the value should be between Minpoolsize and Maxpoolsize. Default:3
MaxIdleTime: Maximum idle time, unused in 60 seconds, the connection is discarded. If 0, it will never be discarded. default:0
Maxpoolsize: The maximum number of connections that are kept in the connection pool. Default:15
MAXSTATEMENTS:JDBC standard parameter to control the number of PREPAREDST atements loaded within the data source. However, because the pre-cached statements belong to a single connection instead of the entire connection pool. So setting this parameter takes into account a variety of factors. If both maxstatements and maxstatementsperconnection are 0, the cache is closed. default:0
Maxstatementsperconnection:maxstatementsperconnection defines the maximum number of cache statements that a single connection in a connection pool has. default:0
NUMHELPERTHREADS:C3P0 are asynchronous operations, and slow JDBC operations are done by helping the process. Extending these operations can effectively improve performance by implementing multiple operations at the same time through multithreading. Default:3
Overridedefaultuser: When the user calls getconnection (), the root user becomes the user to get the connection. Used primarily when connection pooling is connected to a non-c3p0 data source. Default:null
Overridedefaultpassword: A parameter that corresponds to the Overridedefaultuser parameter. Default:null
Password: password. Default:null
User: Username. Default:null
Preferredtestquery: Defines test statements that are executed by all connection tests. This one significantly improves the test speed in the case of connection testing. Note: The test table must exist at the time of the initial data source. Default:null
Propertycycle: The user waits up to 300 seconds before modifying the system configuration parameters to execute. Defaul t:300
Testconnectiononcheckout: Please use it only when you need it because of high performance consumption. If set to true then the validity of each connection submission is officer. We recommend using methods such as Idleconnectio ntestperiod or automatictesttable to improve the performance of your connectivity tests. Default:false
Testconnectiononcheckin: If set to true then the validity of the officer connection is obtained while the connection is made. Default:false
Proxool Acquireincrement: c3p0 The number of connections fetched at a time when the connection in the connection pool is exhausted. Default:3
Fatal-sql-exception: It is a comma-delimited piece of information. When an SQL exception occurs, his exception information is compared to this fragment of information. If present in the fragment, the exception will be considered a fatal error (Fatal SQL exception). In this case, the database connection will be discarded. No matter what happens, this exception will be re-thrown to provide to the consumer. It is best for users to configure a different exception to throw.
Fatal-sql-exception-wrapper-class: As mentioned above, you'd better configure a different exception to re-throw. With this attribute, the user can wrap the SqlException and make him another exception. This exception or inheritance The SqlException or inherited word Runtimeexception.proxool comes with 2 implementations: ' Org.logicalcobwebs.proxool. Fatalsqlexception ' and ' Org.logicalcobweb s.proxool. Fatalruntimeexception '. The latter is more appropriate.
House-keeping-sleep-time:house keeper retains the maximum amount of time a thread is asleep, house keeper's job is to check the status of each connection and determine whether it needs to be destroyed or created.
House-keeping-test-sql: If an idle database connection is found. House keeper will be tested with this statement. This statement is best executed very quickly. If there is no definition, the test process will be ignored.
Injectable-connection-interface: Allows the Proxool to implement the Connection object method being proxied.
Injectable-statement-interface: Allows Proxool to implement the statement object method being proxied.
Injectable-prepared-statement-interface: Allows Proxool to implement Prepareds Tatement object methods that are proxied.
Injectable-callable-statement-interface: Allows Proxool to implement Callablestat Ement object methods that are proxied.
JMX: If the property is true, a message bean is registered to the JMS service, the message Bean object name: "Proxool:type=pool, name=<alias>". The default value is False.
Jmx-agent-id: A comma-delimited list of JMX proxies, such as connection pools registered with Mbeanserverfactory. Fi ndmbeanserver (String agentid). This property is valid only if the "JMX" property is set to "true". All registered JMX servers use this property to be indeterminate
Jndi-name: Name of the data source
Maximum-active-time: If housekeeper detects that the active time of a thread is greater than this number. It will kill this thread. So confirm the bandwidth of your server. Then set a suitable value. The default is 5 minutes.
Maximum-connection-count: Maximum number of database connections.
Maximum-connection-lifetime: The maximum lifespan of a thread.
Minimum-connection-count: Minimum number of database connections
Overload-without-refusal-lifetime: This can help us determine the status of the connection pool. If we have rejected a connection at this setpoint (MS), then it is considered overloaded. The default is 60 seconds.
Prototype-count: The number of connections available in the connection pool. If the connection in the current connection pool is less than this number. The new connection will be established (assuming no more than the maximum available number). For example, we have 3 active connections 2 available connections, and our prototype-count is 4, Then the database connection pool will attempt to establish an additional 2 connections. This is different from Minimum-connection-count. Minimum-connect Ion-count also calculates the connection of the activity. Prototype-count is the number of spare connections.
Recently-started-threshold: This can help us determine the state of the connection pool, whether the number of connections is few or more or overloaded. As long as at least one connection has started in this value (in milliseconds), or there are some redundant connections available, we assume that the connection pool is open. Default is 60 seconds
Simultaneous-build-throttle: This is the maximum number of connections we can make at one time. That is the new connection request, but there is no connection available. Because a connection can use multiple threads to establish a connection between a limited amount of time to bring in a usable link, we need some way to confirm that some threads are not responding immediately to the connection request, which is 10 by default.
Statistics: Connection pool usage statistics. Parameter "10s,1m,1d"
Statistics-log-level: Log statistics trace type. Parameter "ERROR" or "INFO"
Test-before-use: If True, the connection will be served before each connection is tested, and if one connection fails, it is discarded, the other connection will be processed, and if all connections fail, a new connection will be established. Otherwise, a SqlException exception will be thrown.
Test-after-use: If True, the connection will be serviced after each connection has been tested, returning it to the connection pool and discarded if the connection fails.
Trace: If true, then each executed SQL statement will be logged at the execution time (DEBUG level). You can also register a connectionlistener (see Proxoolfacade) to get this information
Bonecp Acquireincrement: c3p0 The number of connections fetched at a time when the connection in the connection pool is exhausted. Default:3
Driveclass: Database Driver
Jdbcurl: Response-driven Jdbcurl
Username: User name of the database
Password: password for the database
Idleconnectiontestperiod: Check the interval of the connection in the database connection pool, the unit is the default value: 240, if you want to cancel set to 0
Idlemaxage: The maximum surviving time of unused links in the connection pool, in units of minutes, default: 60, if you want to live forever set to 0
Maxconnectionsperpartition: Maximum number of connections per partition
Minconnectionsperpartition: Minimum number of connections per partition
Partitioncount: Number of partitions, default value 2, minimum 1, recommended 3-4, depending on application
Acquireincrement: Each time to get a database connection when you want to get a few, the default value: 2
Statementscachesize: Cache prepared statements size, default value: 0
Releasehelperthreads: Each partition releases the number of link attendant processes, the default value: 3, unless you do a lot of work during a database connection, or excessive assistant processes can affect your performance
 Performance Comparison:


DBCP C3p0 Proxool Bonecp
Simulating 5 threads Looping 10 concurrent accesses to a database Spents 1181ms Spents 860ms Spents 1563ms Spents 31ms
Simulating 10 threads Looping 10 concurrent accesses to a database Spents 1188ms Spents 953ms Spents 1625ms Spents 63ms
Simulating 30 threads Looping 10 concurrent accesses to a database Spents 1250ms Spents 1047ms Spents 1657ms Spents 156ms
Simulating 50 threads looping 10 concurrent accesses to a database Spents 1406ms Spents 1343ms Spents 1843ms Spents 172ms
Simulating 100 threads Looping 10 concurrent accesses to a database Spents 1641ms Spents 2703ms Spents 2031ms Spents 532ms
Simulating 200 threads Looping 10 concurrent accesses to a database Spents 2093ms Spents 4891ms Spents 2406ms Spents 936ms
Simulating 500 threads Looping 10 concurrent accesses to a database Spents 3219ms Spents 11703ms Spents 3343ms Spents 1922ms
Simulating 800 threads Looping 10 concurrent accesses to a database Spents 4688ms Spents 12063ms Spents 4141ms Spents 2859ms
Simulating 1000 threads Looping 10 concurrent accesses to a database Spents 5187ms Spents 12563ms Spents 4703m Spents 3610ms
Simulating 3,000 threads looping 10 concurrent accesses to a database Spents 14094ms Spents 16297ms Spents 11344ms Spents 11391ms
Simulating 5,000 threads Looping 10 concurrent accesses to a database Spents 23610ms Spents 22032ms Spents 20125ms Spents 17125ms

DBCP, C3P0, Proxool, BONECP Open source connection pool comparison

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.