perf: 收敛后端资源与健康检查开销
- 缩小模块扫描范围并显式注册各业务模块自动配置 - 增加可配置线程池、MQ 连接池与消费线程池,降低默认资源占用 - 将 RAG 与分析库中间件探活下沉到健康检查并增加短缓存 - 补齐文档向量库生命周期释放与 SSE 断连清理
This commit is contained in:
@@ -25,6 +25,11 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-actuator</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.clickhouse</groupId>
|
||||
<artifactId>clickhouse-jdbc</artifactId>
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package tech.easyflow.common.analyticaldb.support;
|
||||
|
||||
import org.springframework.boot.actuate.health.Health;
|
||||
import org.springframework.boot.actuate.health.HealthIndicator;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 分析数据库健康检查。
|
||||
*/
|
||||
@Component("analyticalDbHealthIndicator")
|
||||
public class AnalyticalDBHealthIndicator implements HealthIndicator {
|
||||
|
||||
private final AnalyticalDBHealthSupport healthSupport;
|
||||
|
||||
/**
|
||||
* 创建分析数据库健康检查器。
|
||||
*
|
||||
* @param healthSupport 分析数据库健康检查支持
|
||||
*/
|
||||
public AnalyticalDBHealthIndicator(AnalyticalDBHealthSupport healthSupport) {
|
||||
this.healthSupport = healthSupport;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查分析数据库是否可用。
|
||||
*
|
||||
* @return 健康状态
|
||||
*/
|
||||
@Override
|
||||
public Health health() {
|
||||
if (!healthSupport.enabled()) {
|
||||
return Health.up().withDetail("enabled", false).build();
|
||||
}
|
||||
try {
|
||||
healthSupport.selfCheck();
|
||||
return Health.up().withDetail("enabled", true).build();
|
||||
} catch (Exception e) {
|
||||
return Health.down(e).withDetail("enabled", true).build();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user