From b78ce1689a31f2fd086a70123bd37c093ec8edd3 Mon Sep 17 00:00:00 2001 From: GuanMu Date: Mon, 25 Aug 2025 09:51:37 +0800 Subject: [PATCH] feat: Add SQLALCHEMY_MAX_OVERFLOW configuration to support database connection pool overflow (#24432) --- docker/.env.example | 2 ++ docker/docker-compose.yaml | 1 + 2 files changed, 3 insertions(+) diff --git a/docker/.env.example b/docker/.env.example index 826b7b9fe..711898016 100644 --- a/docker/.env.example +++ b/docker/.env.example @@ -215,6 +215,8 @@ DB_DATABASE=dify # The size of the database connection pool. # The default is 30 connections, which can be appropriately increased. SQLALCHEMY_POOL_SIZE=30 +# The default is 10 connections, which allows temporary overflow beyond the pool size. +SQLALCHEMY_MAX_OVERFLOW=10 # Database connection pool recycling time, the default is 3600 seconds. SQLALCHEMY_POOL_RECYCLE=3600 # Whether to print SQL, default is false. diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index 0c352e465..d3b75d93a 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -57,6 +57,7 @@ x-shared-env: &shared-api-worker-env DB_PORT: ${DB_PORT:-5432} DB_DATABASE: ${DB_DATABASE:-dify} SQLALCHEMY_POOL_SIZE: ${SQLALCHEMY_POOL_SIZE:-30} + SQLALCHEMY_MAX_OVERFLOW: ${SQLALCHEMY_MAX_OVERFLOW:-10} SQLALCHEMY_POOL_RECYCLE: ${SQLALCHEMY_POOL_RECYCLE:-3600} SQLALCHEMY_ECHO: ${SQLALCHEMY_ECHO:-false} SQLALCHEMY_POOL_PRE_PING: ${SQLALCHEMY_POOL_PRE_PING:-false}