Tomcat connection pool Configuration

Source: Internet
Author: User

I. Connection Pool Configuration

  

<Bean class = "org. Apache. tomcat. JDBC. Pool. poolproperties"> <property name = "url" value = "$ {jdbcurl}"/> <! -- Database driver --> <property name = "driverclassname" value = "com. MySQL. JDBC. Driver"/> <! -- Username --> <property name = "username" value = "MySQL"/> <! -- Password --> <property name = "password" value = "123456" type = "codeph" text = "/codeph"/> <! -- Register the JMX pool. Default Value: True --> <property name = "jmxenabled" value = "false"/> <! -- Check the time interval of the connection life and death, in milliseconds --> <property name = "validationinterval" value = "30000"/> <! -- Determines whether the connection enters Idle State and whether it has been verified by the idle object eviction process. If the verification fails, the connection is disconnected by the connection pool and the value is true, the validationquery parameter must be a non-empty string ----> <property name = "testwhileidle" value = "false"/> <! -- Specifies whether the check value is true when the connection is returned to the pool, the validationquery parameter must be a non-empty string ----> <property name = "testonreturn" value = "false"/> <! -- Indicates whether the connection is verified when it is called. If the verification fails, the connection is disconnected from the connection pool and the connection pool tries to call another connection with the value true, the validationquery parameter must be a non-empty string --> <property name = "testonborrow" value = "true"/> <! -- The SQL statement used to verify whether the connection is valid before the connection is returned to the caller. If an SQL statement is specified, it must be a SELECT statement, at least one row of results --> <property name = "validationquery" value = "select 1"/> <! -- Maximum number of database connections in the active state of the connection pool. 0 indicates no limit, indicating maximum concurrency --> <property name = "maxactive" value = "1000"/> <! -- Initialize connections --> <property name = "initialsize" value = "10"/> <! -- When connections in the connection pool are used up, the new request wait time (that is, waiting for other connections to be idle) returns an exception upon timeout, millisecond --> <property name = "maxwait" value = "100000"/> <! -- The number of milliseconds that indicate that the idle object eviction process enters the running state from the sleep state, if the value is not positive, it indicates that no idle object is run. The time interval for the process to run and judge the connection timeout task --> <property name = "timebetweenevictionrunsmillis" value = "30000"/> <! -- Millisecond indicates the minimum time to keep idle in the pool before the process is evicted by idle objects, and the connection timeout time, the default value is half an hour --> <property name = "minevictableidletimemillis" value = "30000"/> <! -- The Connection Pool checks the number of objects in each idle object eviction process <property name = "numtestperevictionrun" value = "3"/> --> <! -- The minimum number of database connections in the idle state in the connection pool. A value lower than this value will create a connection that is missing, 0 unlimited --> <property name = "minidle" value = "10"/> <! -- The maximum number of idle database connections in the connection pool. A non-positive integer indicates no restriction, when this value is exceeded, redundant idle connections will be released --> <property name = "maxidle" value = "200"/> <! -- Indicates whether to clear information in logs when invalid connections are cleared --> <property name = "logabandoned" value = "false"/> <! -- Whether to clear invalid connections that have exceeded the removeabandonedtimeout setting, and automatically reclaim the timeout connection startup mechanism: getnumactive ()> getmaxactive ()-3 and getnumidle () <2 suppose maxactive = 20, however, the current 18 active connections and 1 idle connection will be enabled, but the duration of the active connection will not exceed "removeabandonedtimeout" (default: 300 seconds ), will be cleared --> <property name = "removeabandoned" value = "true"/> <! -- In seconds indicates the time limit for clearing invalid connections, self-interruption time, in seconds --> <property name = "removeabandonedtimeout" value = "60"/> <! -- Sets the Interceptor. The default value is null connectionstate: Automatic Tracking commit, read-only directory and transaction isolation level statementfinalizer: The statement opened by the trail, and closes the connection and returns to the pool --> <property name = "jdbcinterceptors" value = "org. apache. tomcat. JDBC. pool. interceptor. connectionstate; Org. apache. tomcat. JDBC. pool. interceptor. statementfinalizer "/> </bean>

 

Tomcat connection pool Configuration

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.