Revise Default Configuration for High Availability: Current Settings Are Not Production-Ready #16818

Closed
opened 2026-02-21 19:27:53 -05:00 by yindo · 0 comments
Owner

Originally created by @louxingyu380 on GitHub (Sep 6, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • Please do not modify this template :) and fill in all the required fields.

1. Is this request related to a challenge you're experiencing? Tell me about your story.

Hi Dify team,

We're building a production-grade internal AI assistant using Dify, and during our high-availability (HA) and load testing, we noticed that the default configuration values are too conservative for real-world, scalable deployments.

The current defaults appear optimized for local development or single-instance deployment, but they can become bottlenecks in clustered or high-traffic environments. For example:

Configuration Default Value Issue
SERVER_WORKER_AMOUNT 1 Single worker → no concurrency, becomes a performance bottleneck
POSTGRES_MAX_CONNECTIONS 100 Too low for multi-instance or high-concurrency scenarios
SQLALCHEMY_POOL_SIZE 30 May exhaust under load when scaling out
SQLALCHEMY_MAX_OVERFLOW 10 Limited burst capacity for connection spikes
With only 1 worker, even if we deploy multiple Dify instances behind a load balancer, each process can only handle one request at a time (in synchronous mode), leading to long queueing delays under load.

Suggested Improvements:
Increase default SERVER_WORKER_AMOUNT based on CPU cores (e.g., workers = cpu_count * 2 + 1) or allow auto-detection in production mode.
Raise default database limits:
POSTGRES_MAX_CONNECTIONS: ≥ 300
SQLALCHEMY_POOL_SIZE: 50
SQLALCHEMY_MAX_OVERFLOW: 20
Document HA best practices: Provide an official HA deployment guide with recommended configs for production, including Gunicorn/Uvicorn settings, DB pool sizing, and connection reuse.

🎯 Why This Matters:
These changes would help Dify transition from a great prototyping tool to a truly production-ready platform. Right now, users must manually discover and tune these settings — often only after hitting performance issues.

By adjusting defaults and providing clear guidance, you’ll empower teams to deploy reliable, scalable AI applications out of the box.

Thanks for considering this enhancement!

2. Additional context or comments

No response

3. Can you help us with this feature?

  • I am interested in contributing to this feature.
Originally created by @louxingyu380 on GitHub (Sep 6, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] Please do not modify this template :) and fill in all the required fields. ### 1. Is this request related to a challenge you're experiencing? Tell me about your story. Hi Dify team, We're building a production-grade internal AI assistant using Dify, and during our high-availability (HA) and load testing, we noticed that the default configuration values are too conservative for real-world, scalable deployments. The current defaults appear optimized for local development or single-instance deployment, but they can become bottlenecks in clustered or high-traffic environments. For example: Configuration Default Value Issue SERVER_WORKER_AMOUNT 1 Single worker → no concurrency, becomes a performance bottleneck POSTGRES_MAX_CONNECTIONS 100 Too low for multi-instance or high-concurrency scenarios SQLALCHEMY_POOL_SIZE 30 May exhaust under load when scaling out SQLALCHEMY_MAX_OVERFLOW 10 Limited burst capacity for connection spikes With only 1 worker, even if we deploy multiple Dify instances behind a load balancer, each process can only handle one request at a time (in synchronous mode), leading to long queueing delays under load. ✅ Suggested Improvements: Increase default SERVER_WORKER_AMOUNT based on CPU cores (e.g., workers = cpu_count * 2 + 1) or allow auto-detection in production mode. Raise default database limits: POSTGRES_MAX_CONNECTIONS: ≥ 300 SQLALCHEMY_POOL_SIZE: 50 SQLALCHEMY_MAX_OVERFLOW: 20 Document HA best practices: Provide an official HA deployment guide with recommended configs for production, including Gunicorn/Uvicorn settings, DB pool sizing, and connection reuse. 🎯 Why This Matters: These changes would help Dify transition from a great prototyping tool to a truly production-ready platform. Right now, users must manually discover and tune these settings — often only after hitting performance issues. By adjusting defaults and providing clear guidance, you’ll empower teams to deploy reliable, scalable AI applications out of the box. Thanks for considering this enhancement! ### 2. Additional context or comments _No response_ ### 3. Can you help us with this feature? - [x] I am interested in contributing to this feature.
yindo added the 💪 enhancement📚 documentation labels 2026-02-21 19:27:53 -05:00
yindo closed this issue 2026-02-21 19:27:53 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#16818