Understanding Tomcat Connection Pool Settings

I want to know if I understood the life cycle of the Tomcat Connection pool correctly.

For example, I have the following settings:

<Resource name="jdbc/appname" auth="Container"
type="javax.sql.DataSource" maxActive="100" 
maxIdle="30" maxWait="1000"
username="username" 
initialSize = "5"
password="password"
driverClassName="jdbc.driver.name"
url="jdbc:protocol://hostname:port/dbname"/>

When my application is deployed, it has 5 connections (initial size), when all these connections are occupied by tomcat, create and add to join a new connection (6), this new connection limit is maxActive (100) and when 101 requests come, tomcat will wait for 1000 ms (maxWait), and then throws a TimeOutException. In a certain period of time, only 40 connections are busy, and when one of them is free, it will be destroyed, because the pool has almost 30 (maxIdle) free connections. I'm right?

And if so, what is the purpose of setting maxIdle and maxActive to different values?

+4
source share
1

40 , , , 30 (maxIdle) .

40 , , , :

39 busy connections
1 idle connection 

maxActive , . maxIdle .

, maxActive 100, - , , 100 , , .

maxIdle. , X. 30, 70 100 .

+2

Source: https://habr.com/ru/post/1687348/


All Articles