| |

VerySource

 Forgot password?
 Register
Search
View: 670|Reply: 2

Will JDBC multiple connections make the connection pool unstable?

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-21 13:40:02
| Show all posts |Read mode
If it is unstable, is there any way to connect automatically and close automatically?
Reply

Use magic Report

0

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-1-30 22:45:01
| Show all posts
First of all, "connections" refers to the connection between your application server and database server, not the connection between client IE and your web / application server.

The database connection buffer pool is to reduce the overhead of each time a connection is established / released. Therefore, the connection returned by the terminal is not closed directly, but is reserved for other programs in the future. Returned to the pool, the ones that are not used are called idle, and the ones that are lent out are called active.

So as the name suggests, maxIdle means that when the idle connection in the pool reaches this value, all returned connections will be released directly until the number of idle connections in the pool is lower than maxIdle because other programs continue to lend. In addition, the maximum time for idle is generally set, such as more than 30 seconds, idle connection is also wasted, so turn it off

The maxActive person represents the maximum number of connections you can borrow from this pool. When lending, when there is an idle in the pool, the idle is used. If there is no one and the maxActive is not reached, a new one is created. If the value of maxActive has been reached, there are generally the following types according to different pool types and / or different settings:

1 Direct throw
2 Let the thread that wants to lend a connection wait for a while, if it can't wait, throw an error
3 Check the pool every other period until there are available connections, otherwise wait forever
4 Always available (maxActive is not set or 0 or negative as needed)
-------------------------------------------------- ----
Come here! After reading it, it is estimated that the questions you ask can be answered! !!
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 United States

 Author| Post time: 2020-1-31 09:18:01
| Show all posts
Thank you upstairs.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list