C3P0 configuration initialpoolsize and minpoolsize can be set to 0? Is it bad to set 0?

Source: Internet
Author: User

c3p0 configuration initialpoolsize and minpoolsize can be set to 0? Is it bad to set 0 ? 
C3P0 configuration  initialpoolsize and minpoolsize can be set to 0? Is it bad to set 0?
2015-04-14 11:18
The questioner is adopted byEnthusiastic Netizen
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.2</version>
</dependency>

This article provides a detailed explanation of the various configurations that C3P0 is using in the Sdkservice production environment, and is designed to provide a reference standard for C3P0 configuration.
The configuration of the Sdkservice build environment is as follows:
#当连接池中的连接耗尽的时候c3p0一次同时获取的连接数. Default:3
C3p0.acquireincrement=20
#初始化时获取连接数, the value should be between Minpoolsize and Maxpoolsize. Default:3

C3p0.initialpoolsize=20
#连接池中保留的最小连接数, the default is: 3
C3p0.minpoolsize=20
#连接池中保留的最大连接数. Default value: 15
c3p0.maxpoolsize=100
#最大空闲时间, the connection is discarded if it is not used in a few seconds. If 0, it will never be discarded. Default value: 0
C3p0.maxidletime=60
#c3p0全局的PreparedStatements缓存的大小. If both maxstatements and maxstatementsperconnection are 0, the cache does not take effect, and if one is not 0, the statement's cache will take effect. If the default value is: 0
C3p0.maxstatements=0
#c3p0是异步操作的, slow JDBC operations are done through the help process. Extending these operations can effectively improve performance by implementing multiple operations at the same time through multithreading. Default:3
c3p0.numhelperthreads=10
#定义在从数据库获取新连接失败后重复尝试的次数. Default value: 30, less than or equal to 0 means infinite number of times

C3p0.acquireretryattempts=5
#重新尝试的时间间隔, the default is: 1000 milliseconds
c3p0.acquireretrydelay=300
#获取一个connection需要的时间, per millisecond
c3p0.checkouttimeout=3000
#每隔多少秒检查所有连接池中的空闲连接. default:0

C3p0. Idleconnectiontestperiod=60
#c3p0将建一张名为改配置项的空表 and test it with its own query statement. If this parameter is defined, then the attribute Preferredtestquery # is ignored. You cannot do anything on this test sheet, it will be used only for C3P0 testing. Default value: null. Because the database user of the operating platform does not have permissions to create tables, SQL is required to create tables.
C3p0.automatictesttable=sys_connectiontest
#如果设为true那么在取得连接的同时将校验连接的有效性. Default:false
C3p0.testconnectiononcheckin=true
#一个checkout连接的超时设置, once a checkout connection expires, he will physically shut down instead of returning to the pool, primarily to prevent the connection from being released for long-term use, and this setting is also more dangerous
C3p0.unreturnedconnectiontimeout=15

The following chunking explains the origin of each configuration item value.
Base Connection Pool configuration:
Maxpoolsize maximum number of connections to meet the needs of the application, refer to the default value of 15, the smaller the better. The value is changed more and more because the Sdkservice has not enough connections to the number of times. Has now been changed to 100.
Minpoolsize minimum number of connections needs to be less than or equal to the maximum number of connections, refer to the default value of 3, the smaller the better. The reason for the same maxpoolsize has now been changed to 20.
Initialpoolsize initializes the number of connections between the maximum and minimum number of connections, otherwise it is replaced by the value of the minimum number of connections, referring to the default value of 3. The reason for the same maxpoolsize has now been changed to 20.
Acquireincrement connection exhausted when the number of connections obtained at a time, referring to the default value of 3, because the sdkservice used by the MySQL proxy when the connection is not enough to expand, there will be an exception to get the connection failure, Therefore, the value of acquireincrement is set large to reduce the expansion exception of MySQL proxy.
MaxIdleTime The maximum idle time that is not used during this time is discarded. Set to 60 seconds.

C3P0 configuration initialpoolsize and minpoolsize can be set to 0? Is it bad to set 0?

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.