Commit 28965b9bbf5d5606f2b4762d09d1f3dd2f3af74f
1 parent
942f51dd
reactor:优化数据连接池的配置
Showing
2 changed files
with
13 additions
and
9 deletions
yudao-server/src/main/resources/application-dev.yaml
| @@ -33,14 +33,16 @@ spring: | @@ -33,14 +33,16 @@ spring: | ||
| 33 | initial-size: 5 # 初始连接数 | 33 | initial-size: 5 # 初始连接数 |
| 34 | min-idle: 10 # 最小连接池数量 | 34 | min-idle: 10 # 最小连接池数量 |
| 35 | max-active: 20 # 最大连接池数量 | 35 | max-active: 20 # 最大连接池数量 |
| 36 | - max-wait: 600000 # 配置获取连接等待超时的时间,单位:毫秒 | ||
| 37 | - time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒 | ||
| 38 | - min-evictable-idle-time-millis: 300000 # 配置一个连接在池中最小生存的时间,单位:毫秒 | ||
| 39 | - max-evictable-idle-time-millis: 900000 # 配置一个连接在池中最大生存的时间,单位:毫秒 | ||
| 40 | - validation-query: SELECT 1 # 配置检测连接是否有效 | 36 | + max-wait: 60000 # 配置获取连接等待超时的时间,单位:毫秒(1 分钟) |
| 37 | + time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒(1 分钟) | ||
| 38 | + min-evictable-idle-time-millis: 600000 # 配置一个连接在池中最小生存的时间,单位:毫秒(10 分钟) | ||
| 39 | + max-evictable-idle-time-millis: 1800000 # 配置一个连接在池中最大生存的时间,单位:毫秒(30 分钟) | ||
| 40 | + validation-query: SELECT 1 FROM DUAL # 配置检测连接是否有效 | ||
| 41 | test-while-idle: true | 41 | test-while-idle: true |
| 42 | test-on-borrow: false | 42 | test-on-borrow: false |
| 43 | test-on-return: false | 43 | test-on-return: false |
| 44 | + pool-prepared-statements: true # 是否开启 PreparedStatement 缓存 | ||
| 45 | + max-pool-prepared-statement-per-connection-size: 20 # 每个连接缓存的 PreparedStatement 数量 | ||
| 44 | primary: master | 46 | primary: master |
| 45 | datasource: | 47 | datasource: |
| 46 | master: | 48 | master: |
yudao-server/src/main/resources/application-local.yaml
| @@ -37,14 +37,16 @@ spring: | @@ -37,14 +37,16 @@ spring: | ||
| 37 | initial-size: 1 # 初始连接数 | 37 | initial-size: 1 # 初始连接数 |
| 38 | min-idle: 1 # 最小连接池数量 | 38 | min-idle: 1 # 最小连接池数量 |
| 39 | max-active: 20 # 最大连接池数量 | 39 | max-active: 20 # 最大连接池数量 |
| 40 | - max-wait: 600000 # 配置获取连接等待超时的时间,单位:毫秒 | ||
| 41 | - time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒 | ||
| 42 | - min-evictable-idle-time-millis: 300000 # 配置一个连接在池中最小生存的时间,单位:毫秒 | ||
| 43 | - max-evictable-idle-time-millis: 900000 # 配置一个连接在池中最大生存的时间,单位:毫秒 | 40 | + max-wait: 60000 # 配置获取连接等待超时的时间,单位:毫秒(1 分钟) |
| 41 | + time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒(1 分钟) | ||
| 42 | + min-evictable-idle-time-millis: 600000 # 配置一个连接在池中最小生存的时间,单位:毫秒(10 分钟) | ||
| 43 | + max-evictable-idle-time-millis: 1800000 # 配置一个连接在池中最大生存的时间,单位:毫秒(30 分钟) | ||
| 44 | validation-query: SELECT 1 FROM DUAL # 配置检测连接是否有效 | 44 | validation-query: SELECT 1 FROM DUAL # 配置检测连接是否有效 |
| 45 | test-while-idle: true | 45 | test-while-idle: true |
| 46 | test-on-borrow: false | 46 | test-on-borrow: false |
| 47 | test-on-return: false | 47 | test-on-return: false |
| 48 | + pool-prepared-statements: true # 是否开启 PreparedStatement 缓存 | ||
| 49 | + max-pool-prepared-statement-per-connection-size: 20 # 每个连接缓存的 PreparedStatement 数量 | ||
| 48 | primary: master | 50 | primary: master |
| 49 | datasource: | 51 | datasource: |
| 50 | master: | 52 | master: |