In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
# initialization connections: the minimum number of initialSize=1# idle connections created when the connection pool starts: the minimum number of connections allowed to remain idle in the connection pool, below which new connections will be created. If set to 0, minIdle=1# maximum idle connections will not be created: the maximum number of connections allowed to remain idle in the connection pool will be released. If set to negative number, there is no limit to maxIdle=2# maximum active connections: the maximum number of active connections that can be allocated by the connection pool at the same time; if set to non-positive number, it means that there is no limit to maxActive=3# lending connections. Do not test. Otherwise, it affects performance testOnBorrow=false# indicates whether the connection is checked by the idle connection recycler (if any). If the detection fails, the connection will be removed from the pool. TestWhileIdle=true# runs the idle connection collector every X seconds timeBetweenEvictionRunsMillis=30000# removes the missing link removeAbandonedOnMaintenance=true# query check validationQuery=SELECT 1 when the check thread completes the check
-
Self-detection of DBCP connection pool
-
The default configuration of the DBCP connection pool does not test the connection in the pool, sometimes the connection has been disconnected, but the DBCP connection pool does not know and thinks that the connection is good.
An error must be reported when an application removes such a connection from the pool to access the database. This is also the reason why many people don't like DBCP.
Example 1:
MySQL8 hour problem. The default connection "wait_timeout" of the Mysql server is 8 hours, that is, if a connection is idle for more than 8 hours, the Mysql will automatically disconnect the connection.
But the DBCP connection pool does not know that the connection has been broken, and if the program happens to use the disconnected connection, the program will report an error.
Example 2:
In the past, the Sybase database was also used, but for some reason, the database was restarted after it died, or it was restored after being disconnected.
After waiting for about 10 minutes, the connections in the DBCP connection pool are still unavailable (disconnected), and the data access application keeps reporting an error. In the end, the problem of restarting Tomcat can only be solved.
Solution:
Plan 1, test the connection regularly, and close the connection if the test fails.
Option 2, control the idle time of the connection to reach N minutes, then close the connection (and then you can create a new connection).
The two kinds of problems can be solved by using either of the above two schemes. If only option 2 is used, it is recommended that N
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.