perf(db): configure database connection pools
Add configurable PostgreSQL and database/sql pool limits, validate invalid environment values, clamp idle connections, and cover the parsing/application logic with unit tests.
This commit is contained in:
@@ -210,6 +210,15 @@ DB_PASSWORD=postgres123!@#
|
||||
# 数据库名称
|
||||
DB_NAME=WeKnora
|
||||
|
||||
# PostgreSQL 全局最大连接数(Compose 内置 PostgreSQL 服务)
|
||||
POSTGRES_MAX_CONNECTIONS=300
|
||||
|
||||
# WeKnora database/sql 连接池
|
||||
DB_MAX_OPEN_CONNS=120
|
||||
DB_MAX_IDLE_CONNS=20
|
||||
DB_CONN_MAX_IDLE_TIME=5m
|
||||
DB_CONN_MAX_LIFETIME=10m
|
||||
|
||||
# 如果使用 redis 作为流处理后端,需要配置以下参数
|
||||
# Redis用户名,Redis 6.0+ ACL 功能支持(可选)
|
||||
# REDIS_USERNAME=
|
||||
|
||||
Reference in New Issue
Block a user