Highly recommended by old friends, use HikariCP to greatly improve database connection performance
purpose
Yesterday, Druid was replaced with the stable version of C3P0;
highly recommended by old friends, the use of HikariCP greatly improved the database connection performance;
The final result:
Concurrent 2000 pressure test, c3p0 opened 2000 threads; HikariCP only opened 120 threads!
1. Modify Pom.xml and introduce HikariCP dependency
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
</dependency>
2. Modify applicaton.yml
spring:
application:
name: nh-tst
http:
encoding:
charset: UTF-8
enabled: true
force: true
datasource:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: oracle.jdbc.driver.OracleDriver
url: jdbc:oracle:thin:@xxxxxx:1522/prodpdb1
username: xxxxx
password: xxxxx
hikari:
pool-name: FxdDbPool
minimum-idle: 10
idle-timeout: 600000
maximum-pool-size: 300
auto-commit: true
max-lifetime: 1800000
connection-timeout: 180000
Finally, I sighed: A big copy on the Internet, this configuration has been found in 5 blogs and checked for various errors.
It is not easy to be original, and cherish it!