feat: 优化异步线程池配置,增加设备检测和通用任务线程池的核心与最大线程数,提升并发处理能力;更新数据库连接池配置,增强连接管理和性能
This commit is contained in:
@@ -3,18 +3,18 @@ spring:
|
||||
name: gameplatform-server
|
||||
|
||||
datasource:
|
||||
url: jdbc:mysql://192.140.164.137:3306/login_task_db?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&sessionVariables=innodb_lock_wait_timeout=30
|
||||
url: jdbc:mysql://192.140.164.137:3306/login_task_db?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&sessionVariables=innodb_lock_wait_timeout=10,wait_timeout=300,interactive_timeout=300
|
||||
username: login_task_db
|
||||
password: 3MaXfeWJ4d6cGMrL
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
hikari:
|
||||
maximum-pool-size: 50
|
||||
minimum-idle: 10
|
||||
connection-timeout: 30000
|
||||
idle-timeout: 600000
|
||||
max-lifetime: 1800000
|
||||
leak-detection-threshold: 60000
|
||||
validation-timeout: 5000
|
||||
maximum-pool-size: 100 # 增加最大连接数(从50到100)
|
||||
minimum-idle: 20 # 增加最小空闲连接(从10到20)
|
||||
connection-timeout: 10000 # 降低连接获取超时(从30秒到10秒)
|
||||
idle-timeout: 300000 # 空闲连接超时5分钟(从10分钟降低)
|
||||
max-lifetime: 1800000 # 连接最大存活30分钟
|
||||
leak-detection-threshold: 30000 # 连接泄漏检测30秒(从60秒降低)
|
||||
validation-timeout: 3000 # 连接验证超时3秒(从5秒降低)
|
||||
connection-test-query: SELECT 1
|
||||
# 连接池健康监控和自动重连
|
||||
initialization-fail-timeout: 1
|
||||
@@ -26,8 +26,12 @@ spring:
|
||||
poll:
|
||||
size: 4
|
||||
transaction:
|
||||
default-timeout: 30
|
||||
|
||||
default-timeout: 15 # 降低默认事务超时(从30秒到15秒)
|
||||
mvc:
|
||||
async:
|
||||
request-timeout: 60000 # 异步请求超时60秒
|
||||
lifecycle:
|
||||
timeout-per-shutdown-phase: 30s # 关闭超时30秒
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath:mapper/**/*.xml
|
||||
type-aliases-package: com.gameplatform.server.model.entity
|
||||
@@ -43,12 +47,22 @@ mybatis-plus:
|
||||
|
||||
server:
|
||||
port: 18080
|
||||
# Tomcat 线程池配置 - 提高并发处理能力
|
||||
tomcat:
|
||||
threads:
|
||||
max: 200 # 最大工作线程数(默认200)
|
||||
min-spare: 20 # 最小空闲线程数(默认10)
|
||||
max-connections: 10000 # 最大连接数(默认8192)
|
||||
accept-count: 200 # 等待队列长度(默认100)
|
||||
connection-timeout: 20000 # 连接超时20秒
|
||||
shutdown: graceful # 优雅关闭
|
||||
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: health,info
|
||||
include: health,info,metrics,threaddump
|
||||
|
||||
logging:
|
||||
level:
|
||||
|
||||
Reference in New Issue
Block a user