经老友鼎力推荐,使用HikariCP大幅提升数据库连接性能
-
-
- 目的
- 1.修改Pom.xml,引入HikariCP 依赖
- 2.修改applicaton.yml
-
目的
昨日将Druid替换为稳定版的C3P0;
经老友鼎力推荐,使用HikariCP大幅提升数据库连接性能;
最后结果:
并发2000压测,c3p0开2000线程;HikariCP只开120线程搞定!
1.修改Pom.xml,引入HikariCP 依赖
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
</dependency>
2.修改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
最后感慨:互联网一大抄,这个配置找了5篇博客排查了各种错才搞定;
原创不易,且行且珍惜!