I need a high-concurrency service configuration and a great architect. #17927

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

Originally created by @wanzij on GitHub (Sep 22, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • 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.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.8.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Image Image

✔️ Expected Behavior

Support high concurrency

Actual Behavior

I want to clarify first: our server is fully capable of handling concurrent requests.

System:
  Kernel: 4.18.0-348.7.1.el8_5.x86_64 arch: x86_64 bits: 64 compiler: gcc
    v: 8.5.0 Console: pty pts/2 Distro: CentOS Linux release 8.5.2111
    base: RHEL 8
Machine:
  Type: Kvm System: Tencent Cloud product: CVM v: 3.0 serial: <filter>
  Mobo: N/A model: N/A serial: N/A BIOS: SeaBIOS
    v: seabios-1.9.1-qemu-project.org date: 04/01/2014
CPU:
  Info: 32-core model: AMD EPYC 9K65 bits: 64 type: MT MCP arch: N/A rev: 0
    cache: L1: 2.5 MiB L2: 32 MiB L3: 64 MiB
  Speed (MHz): avg: 2250 min/max: N/A cores: 1: 2250 2: 2250 3: 2250 4: 2250
    5: 2250 6: 2250 7: 2250 8: 2250 9: 2250 10: 2250 11: 2250 12: 2250 13: 2250
    14: 2250 15: 2250 16: 2250 17: 2250 18: 2250 19: 2250 20: 2250 21: 2250
    22: 2250 23: 2250 24: 2250 25: 2250 26: 2250 27: 2250 28: 2250 29: 2250
    30: 2250 31: 2250 32: 2250 33: 2250 34: 2250 35: 2250 36: 2250 37: 2250
    38: 2250 39: 2250 40: 2250 41: 2250 42: 2250 43: 2250 44: 2250 45: 2250
    46: 2250 47: 2250 48: 2250 49: 2250 50: 2250 51: 2250 52: 2250 53: 2250
    54: 2250 55: 2250 56: 2250 57: 2250 58: 2250 59: 2250 60: 2250 61: 2250
    62: 2250 63: 2250 64: 2250 bogomips: 288003
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3
Graphics:
  Device-1: Cirrus Logic GD 5446 vendor: Red Hat QEMU Virtual Machine
    driver: cirrus v: kernel bus-ID: 00:01.0
  Display: server: No display server data found. Headless machine?
  API: N/A Message: No display API data available.
Audio:
  Message: No device data found.
  API: ALSA v: k4.18.0-348.7.1.el8_5.x86_64 status: inactive
Network:
  Device-1: Red Hat Virtio network driver: virtio-pci v: N/A port: e000
    bus-ID: 00:05.0
  IF: eth0 state: up speed: -1 duplex: unknown mac: <filter>
  IF-ID-1: br-1a5d48891815 state: down mac: <filter>
  IF-ID-2: br-1fd5e12fc236 state: down mac: <filter>
  IF-ID-3: br-23d6623354dc state: down mac: <filter>
  IF-ID-4: br-4a087e9b1216 state: up speed: N/A duplex: N/A mac: <filter>
  IF-ID-5: br-676084d63270 state: down mac: <filter>
  IF-ID-6: br-8bd880a4e96a state: down mac: <filter>
  IF-ID-7: br-8d292d696328 state: down mac: <filter>
  IF-ID-8: br-b55d20c278a4 state: up speed: N/A duplex: N/A mac: <filter>
  IF-ID-9: br-ca6d55234601 state: up speed: N/A duplex: N/A mac: <filter>
  IF-ID-10: docker0 state: down mac: <filter>
  IF-ID-11: veth09d217e state: up speed: 10000 Mbps duplex: full
    mac: <filter>
  IF-ID-12: veth17abc65 state: up speed: 10000 Mbps duplex: full
    mac: <filter>
  IF-ID-13: veth17ce8da state: up speed: 10000 Mbps duplex: full
    mac: <filter>
  IF-ID-14: veth352be41 state: up speed: 10000 Mbps duplex: full
    mac: <filter>
  IF-ID-15: veth4059e86 state: up speed: 10000 Mbps duplex: full
    mac: <filter>
  IF-ID-16: veth4077a3d state: up speed: 10000 Mbps duplex: full
    mac: <filter>
  IF-ID-17: veth41dace6 state: up speed: 10000 Mbps duplex: full
    mac: <filter>
  IF-ID-18: veth56cfafa state: up speed: 10000 Mbps duplex: full
    mac: <filter>
  IF-ID-19: veth6cbca6c state: up speed: 10000 Mbps duplex: full
    mac: <filter>
  IF-ID-20: veth6fc2e9f state: up speed: 10000 Mbps duplex: full
    mac: <filter>
  IF-ID-21: veth822597d state: up speed: 10000 Mbps duplex: full
    mac: <filter>
  IF-ID-22: veth83ef32a state: up speed: 10000 Mbps duplex: full
    mac: <filter>
  IF-ID-23: vethbcd6438 state: up speed: 10000 Mbps duplex: full
    mac: <filter>
  IF-ID-24: vethd43a66c state: up speed: 10000 Mbps duplex: full
    mac: <filter>
  IF-ID-25: vethdea1a3b state: up speed: 10000 Mbps duplex: full
    mac: <filter>
  IF-ID-26: vethf521ab1 state: up speed: 10000 Mbps duplex: full
    mac: <filter>
  IF-ID-27: vethfbb1627 state: up speed: 10000 Mbps duplex: full
    mac: <filter>
Drives:
  Local Storage: total: 600 GiB used: 445.48 GiB (74.2%)
  ID-1: /dev/vda model: N/A size: 600 GiB
Partition:
  ID-1: / size: 590.52 GiB used: 445.48 GiB (75.4%) fs: ext4 dev: /dev/vda1
Swap:
  ID-1: swap-1 type: file size: 16 GiB used: 0 KiB (0.0%) file: /swapfile
Sensors:
  Src: lm-sensors+/sys Message: No sensor data found using /sys/class/hwmon
    or lm-sensors.
Info:
  Processes: 1003 Uptime: 2d 10h 39m Memory: total: 126 GiB
  available: 123.17 GiB used: 29.6 GiB (24.0%) Init: systemd
  target: multi-user (3) Compilers: gcc: 8.5.0 Packages: N/A note: see --rpm
  Shell: Bash v: 4.4.20 inxi: 3.3.30

Then I will explain in detail the configuration of deployment dify, sandbox configuration, and workflow call architecture
# When enabled, migrations will be executed prior to application startup
# and the application will start after the migrations have completed.
MIGRATION_ENABLED=true

# File Access Time specifies a time interval in seconds for the file to be accessed.
# The default value is 300 seconds.
FILES_ACCESS_TIMEOUT=315360000

# Access token expiration time in minutes
ACCESS_TOKEN_EXPIRE_MINUTES=60

# Refresh token expiration time in days
REFRESH_TOKEN_EXPIRE_DAYS=30

# The maximum number of active requests for the application, where 0 means unlimited, should be a non-negative integer.
APP_MAX_ACTIVE_REQUESTS=0
APP_MAX_EXECUTION_TIME=1200

# ------------------------------
# Container Startup Related Configuration
# Only effective when starting with docker image or docker-compose.
# ------------------------------

# API service binding address, default: 0.0.0.0, i.e., all addresses can be accessed.
DIFY_BIND_ADDRESS=0.0.0.0

# API service binding port number, default 5001.
DIFY_PORT=5001

# The number of API server workers, i.e., the number of workers.
# Formula: number of cpu cores x 2 + 1 for sync, 1 for Gevent
# Reference: https://docs.gunicorn.org/en/stable/design.html#how-many-workers
SERVER_WORKER_AMOUNT=65

# Defaults to gevent. If using windows, it can be switched to sync or solo.
SERVER_WORKER_CLASS=gevent

# Default number of worker connections, the default is 10.
SERVER_WORKER_CONNECTIONS=1000

# Similar to SERVER_WORKER_CLASS.
# If using windows, it can be switched to sync or solo.
CELERY_WORKER_CLASS=gevent

# Request handling timeout. The default is 200,
# it is recommended to set it to 360 to support a longer sse connection time.
GUNICORN_TIMEOUT=360

# The number of Celery workers. The default is 1, and can be set as needed.
CELERY_WORKER_AMOUNT=8

# Flag indicating whether to enable autoscaling of Celery workers.
#
# Autoscaling is useful when tasks are CPU intensive and can be dynamically
# allocated and deallocated based on the workload.
#
# When autoscaling is enabled, the maximum and minimum number of workers can
# be specified. The autoscaling algorithm will dynamically adjust the number
# of workers within the specified range.
#
# Default is false (i.e., autoscaling is disabled).
#
# Example:
# CELERY_AUTO_SCALE=true
CELERY_AUTO_SCALE=true

# The maximum number of Celery workers that can be autoscaled.
# This is optional and only used when autoscaling is enabled.
# Default is not set.
CELERY_MAX_WORKERS=32

# The minimum number of Celery workers that can be autoscaled.
# This is optional and only used when autoscaling is enabled.
# Default is not set.
CELERY_MIN_WORKERS=2

# API Tool configuration
API_TOOL_DEFAULT_CONNECT_TIMEOUT=10
API_TOOL_DEFAULT_READ_TIMEOUT=60

# -------------------------------
# Datasource Configuration
# --------------------------------
ENABLE_WEBSITE_JINAREADER=true
ENABLE_WEBSITE_FIRECRAWL=true
ENABLE_WEBSITE_WATERCRAWL=true

# ------------------------------
# Database Configuration
# The database uses PostgreSQL. Please use the public schema.
# It is consistent with the configuration in the 'db' service below.
# ------------------------------

DB_USERNAME=postgres
DB_PASSWORD=difyai123456
DB_HOST=db
DB_PORT=5432
DB_DATABASE=dify
# The size of the database connection pool.
# The default is 30 connections, which can be appropriately increased.
SQLALCHEMY_POOL_SIZE=250
# Database connection pool recycling time, the default is 3600 seconds.
SQLALCHEMY_POOL_RECYCLE=3600
# Whether to print SQL, default is false.
SQLALCHEMY_ECHO=false
# If True, will test connections for liveness upon each checkout
SQLALCHEMY_POOL_PRE_PING=false
# Whether to enable the Last in first out option or use default FIFO queue if is false
SQLALCHEMY_POOL_USE_LIFO=false

# Maximum number of connections to the database
# Default is 100
#
# Reference: https://www.postgresql.org/docs/current/runtime-config-connection.html#GUC-MAX-CONNECTIONS
POSTGRES_MAX_CONNECTIONS=500

# Sets the amount of shared memory used for postgres's shared buffers.
# Default is 128MB
# Recommended value: 25% of available memory
# Reference: https://www.postgresql.org/docs/current/runtime-config-resource.html#GUC-SHARED-BUFFERS
POSTGRES_SHARED_BUFFERS=32768MB

# Sets the amount of memory used by each database worker for working space.
# Default is 4MB
#
# Reference: https://www.postgresql.org/docs/current/runtime-config-resource.html#GUC-WORK-MEM
POSTGRES_WORK_MEM=64MB

# Sets the amount of memory reserved for maintenance activities.
# Default is 64MB
#
# Reference: https://www.postgresql.org/docs/current/runtime-config-resource.html#GUC-MAINTENANCE-WORK-MEM
POSTGRES_MAINTENANCE_WORK_MEM=512MB

# Sets the planner's assumption about the effective cache size.
# Default is 4096MB
#
# Reference: https://www.postgresql.org/docs/current/runtime-config-query.html#GUC-EFFECTIVE-CACHE-SIZE
POSTGRES_EFFECTIVE_CACHE_SIZE=65536MB

# ------------------------------
# Redis Configuration
# This Redis configuration is used for caching and for pub/sub during conversation.
# ------------------------------

REDIS_HOST=redis
REDIS_PORT=6379
REDIS_USERNAME=
REDIS_PASSWORD=difyai123456
REDIS_USE_SSL=false
# SSL configuration for Redis (when REDIS_USE_SSL=true)
REDIS_SSL_CERT_REQS=CERT_NONE
# Options: CERT_NONE, CERT_OPTIONAL, CERT_REQUIRED
REDIS_SSL_CA_CERTS=
# Path to CA certificate file for SSL verification
REDIS_SSL_CERTFILE=
# Path to client certificate file for SSL authentication
REDIS_SSL_KEYFILE=
# Path to client private key file for SSL authentication
REDIS_DB=0

# Whether to use Redis Sentinel mode.
# If set to true, the application will automatically discover and connect to the master node through Sentinel.
REDIS_USE_SENTINEL=false

# List of Redis Sentinel nodes. If Sentinel mode is enabled, provide at least one Sentinel IP and port.
# Format: `<sentinel1_ip>:<sentinel1_port>,<sentinel2_ip>:<sentinel2_port>,<sentinel3_ip>:<sentinel3_port>`
REDIS_SENTINELS=
REDIS_SENTINEL_SERVICE_NAME=
REDIS_SENTINEL_USERNAME=
REDIS_SENTINEL_PASSWORD=
REDIS_SENTINEL_SOCKET_TIMEOUT=0.1

# List of Redis Cluster nodes. If Cluster mode is enabled, provide at least one Cluster IP and port.
# Format: `<Cluster1_ip>:<Cluster1_port>,<Cluster2_ip>:<Cluster2_port>,<Cluster3_ip>:<Cluster3_port>`
REDIS_USE_CLUSTERS=false
REDIS_CLUSTERS=
REDIS_CLUSTERS_PASSWORD=

# ------------------------------
# Celery Configuration
# ------------------------------

# Use standalone redis as the broker, and redis db 1 for celery broker. (redis_username is usually set by defualt as empty)
# Format as follows: `redis://<redis_username>:<redis_password>@<redis_host>:<redis_port>/<redis_database>`.
# Example: redis://:difyai123456@redis:6379/1
# If use Redis Sentinel, format as follows: `sentinel://<redis_username>:<redis_password>@<sentinel_host1>:<sentinel_port>/<redis_database>`
# For high availability, you can configure multiple Sentinel nodes (if provided) separated by semicolons like below example:
# Example: sentinel://:difyai123456@localhost:26379/1;sentinel://:difyai12345@localhost:26379/1;sentinel://:difyai12345@localhost:26379/1
CELERY_BROKER_URL=redis://:difyai123456@redis:6379/1
CELERY_BACKEND=redis
BROKER_USE_SSL=false

# If you are using Redis Sentinel for high availability, configure the following settings.
CELERY_USE_SENTINEL=false
CELERY_SENTINEL_MASTER_NAME=
CELERY_SENTINEL_PASSWORD=
CELERY_SENTINEL_SOCKET_TIMEOUT=0.1

# Celery schedule tasks configuration
ENABLE_CLEAN_EMBEDDING_CACHE_TASK=false
ENABLE_CLEAN_UNUSED_DATASETS_TASK=false
ENABLE_CREATE_TIDB_SERVERLESS_TASK=false
ENABLE_UPDATE_TIDB_SERVERLESS_STATUS_TASK=false
ENABLE_CLEAN_MESSAGES=false
ENABLE_MAIL_CLEAN_DOCUMENT_NOTIFY_TASK=false
ENABLE_DATASETS_QUEUE_MONITOR=false
ENABLE_CHECK_UPGRADABLE_PLUGIN_TASK=true

Sandbox:
drwxr-xr-x 2 root root 4096 Sep 22 20:53 conf
drwxr-xr-x 2 root root 4096 Aug 27 16:44 dependencies
drwxrwxrwx 2 root root 4096 Aug 20 00:33 file
[root@VM-0-11-centos sandbox]# cd conf/
[root@VM-0-11-centos conf]# ll
total 8
-rw-r--r-- 1 root root 2091 Sep 22 20:53 config.yaml
-rw-r--r-- 1 root root  762 Aug 19 23:31 config.yaml.example
[root@VM-0-11-centos conf]# vim config.yaml

app:
  port: 8194
  debug: True
  key: dify-sandbox
max_workers: 65
max_requests: 200
worker_timeout: 60
python_path: /usr/local/bin/python3
enable_network: True # please make sure there is no network risk in your environment
allowed_syscalls: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336]
proxy:
  socks5: ''
  http: ''
  https: ''

workflow:
Image

The search tool contains iterations and numerous code nodes:

Image

I think a simple 100 users should be perfectly manageable, but it keeps giving me this error::

Image Image

Could it be that dify can't handle this amount of traffic? I don't think it's possible, or is there something wrong with my configuration? I'd appreciate someone familiar with dify or service architecture to help me review this complete configuration, which already meets my concurrent access requirements!

Originally created by @wanzij on GitHub (Sep 22, 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] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [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] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.8.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce <img width="570" height="195" alt="Image" src="https://github.com/user-attachments/assets/2315813f-5126-48a5-85fd-6ffd54d4f167" /> <img width="554" height="135" alt="Image" src="https://github.com/user-attachments/assets/b5d3a37e-1046-46e5-9660-ac3edeb5d3c7" /> ### ✔️ Expected Behavior Support high concurrency ### ❌ Actual Behavior I want to clarify first: our server is fully capable of handling concurrent requests. ``` System: Kernel: 4.18.0-348.7.1.el8_5.x86_64 arch: x86_64 bits: 64 compiler: gcc v: 8.5.0 Console: pty pts/2 Distro: CentOS Linux release 8.5.2111 base: RHEL 8 Machine: Type: Kvm System: Tencent Cloud product: CVM v: 3.0 serial: <filter> Mobo: N/A model: N/A serial: N/A BIOS: SeaBIOS v: seabios-1.9.1-qemu-project.org date: 04/01/2014 CPU: Info: 32-core model: AMD EPYC 9K65 bits: 64 type: MT MCP arch: N/A rev: 0 cache: L1: 2.5 MiB L2: 32 MiB L3: 64 MiB Speed (MHz): avg: 2250 min/max: N/A cores: 1: 2250 2: 2250 3: 2250 4: 2250 5: 2250 6: 2250 7: 2250 8: 2250 9: 2250 10: 2250 11: 2250 12: 2250 13: 2250 14: 2250 15: 2250 16: 2250 17: 2250 18: 2250 19: 2250 20: 2250 21: 2250 22: 2250 23: 2250 24: 2250 25: 2250 26: 2250 27: 2250 28: 2250 29: 2250 30: 2250 31: 2250 32: 2250 33: 2250 34: 2250 35: 2250 36: 2250 37: 2250 38: 2250 39: 2250 40: 2250 41: 2250 42: 2250 43: 2250 44: 2250 45: 2250 46: 2250 47: 2250 48: 2250 49: 2250 50: 2250 51: 2250 52: 2250 53: 2250 54: 2250 55: 2250 56: 2250 57: 2250 58: 2250 59: 2250 60: 2250 61: 2250 62: 2250 63: 2250 64: 2250 bogomips: 288003 Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 Graphics: Device-1: Cirrus Logic GD 5446 vendor: Red Hat QEMU Virtual Machine driver: cirrus v: kernel bus-ID: 00:01.0 Display: server: No display server data found. Headless machine? API: N/A Message: No display API data available. Audio: Message: No device data found. API: ALSA v: k4.18.0-348.7.1.el8_5.x86_64 status: inactive Network: Device-1: Red Hat Virtio network driver: virtio-pci v: N/A port: e000 bus-ID: 00:05.0 IF: eth0 state: up speed: -1 duplex: unknown mac: <filter> IF-ID-1: br-1a5d48891815 state: down mac: <filter> IF-ID-2: br-1fd5e12fc236 state: down mac: <filter> IF-ID-3: br-23d6623354dc state: down mac: <filter> IF-ID-4: br-4a087e9b1216 state: up speed: N/A duplex: N/A mac: <filter> IF-ID-5: br-676084d63270 state: down mac: <filter> IF-ID-6: br-8bd880a4e96a state: down mac: <filter> IF-ID-7: br-8d292d696328 state: down mac: <filter> IF-ID-8: br-b55d20c278a4 state: up speed: N/A duplex: N/A mac: <filter> IF-ID-9: br-ca6d55234601 state: up speed: N/A duplex: N/A mac: <filter> IF-ID-10: docker0 state: down mac: <filter> IF-ID-11: veth09d217e state: up speed: 10000 Mbps duplex: full mac: <filter> IF-ID-12: veth17abc65 state: up speed: 10000 Mbps duplex: full mac: <filter> IF-ID-13: veth17ce8da state: up speed: 10000 Mbps duplex: full mac: <filter> IF-ID-14: veth352be41 state: up speed: 10000 Mbps duplex: full mac: <filter> IF-ID-15: veth4059e86 state: up speed: 10000 Mbps duplex: full mac: <filter> IF-ID-16: veth4077a3d state: up speed: 10000 Mbps duplex: full mac: <filter> IF-ID-17: veth41dace6 state: up speed: 10000 Mbps duplex: full mac: <filter> IF-ID-18: veth56cfafa state: up speed: 10000 Mbps duplex: full mac: <filter> IF-ID-19: veth6cbca6c state: up speed: 10000 Mbps duplex: full mac: <filter> IF-ID-20: veth6fc2e9f state: up speed: 10000 Mbps duplex: full mac: <filter> IF-ID-21: veth822597d state: up speed: 10000 Mbps duplex: full mac: <filter> IF-ID-22: veth83ef32a state: up speed: 10000 Mbps duplex: full mac: <filter> IF-ID-23: vethbcd6438 state: up speed: 10000 Mbps duplex: full mac: <filter> IF-ID-24: vethd43a66c state: up speed: 10000 Mbps duplex: full mac: <filter> IF-ID-25: vethdea1a3b state: up speed: 10000 Mbps duplex: full mac: <filter> IF-ID-26: vethf521ab1 state: up speed: 10000 Mbps duplex: full mac: <filter> IF-ID-27: vethfbb1627 state: up speed: 10000 Mbps duplex: full mac: <filter> Drives: Local Storage: total: 600 GiB used: 445.48 GiB (74.2%) ID-1: /dev/vda model: N/A size: 600 GiB Partition: ID-1: / size: 590.52 GiB used: 445.48 GiB (75.4%) fs: ext4 dev: /dev/vda1 Swap: ID-1: swap-1 type: file size: 16 GiB used: 0 KiB (0.0%) file: /swapfile Sensors: Src: lm-sensors+/sys Message: No sensor data found using /sys/class/hwmon or lm-sensors. Info: Processes: 1003 Uptime: 2d 10h 39m Memory: total: 126 GiB available: 123.17 GiB used: 29.6 GiB (24.0%) Init: systemd target: multi-user (3) Compilers: gcc: 8.5.0 Packages: N/A note: see --rpm Shell: Bash v: 4.4.20 inxi: 3.3.30 Then I will explain in detail the configuration of deployment dify, sandbox configuration, and workflow call architecture # When enabled, migrations will be executed prior to application startup # and the application will start after the migrations have completed. MIGRATION_ENABLED=true # File Access Time specifies a time interval in seconds for the file to be accessed. # The default value is 300 seconds. FILES_ACCESS_TIMEOUT=315360000 # Access token expiration time in minutes ACCESS_TOKEN_EXPIRE_MINUTES=60 # Refresh token expiration time in days REFRESH_TOKEN_EXPIRE_DAYS=30 # The maximum number of active requests for the application, where 0 means unlimited, should be a non-negative integer. APP_MAX_ACTIVE_REQUESTS=0 APP_MAX_EXECUTION_TIME=1200 # ------------------------------ # Container Startup Related Configuration # Only effective when starting with docker image or docker-compose. # ------------------------------ # API service binding address, default: 0.0.0.0, i.e., all addresses can be accessed. DIFY_BIND_ADDRESS=0.0.0.0 # API service binding port number, default 5001. DIFY_PORT=5001 # The number of API server workers, i.e., the number of workers. # Formula: number of cpu cores x 2 + 1 for sync, 1 for Gevent # Reference: https://docs.gunicorn.org/en/stable/design.html#how-many-workers SERVER_WORKER_AMOUNT=65 # Defaults to gevent. If using windows, it can be switched to sync or solo. SERVER_WORKER_CLASS=gevent # Default number of worker connections, the default is 10. SERVER_WORKER_CONNECTIONS=1000 # Similar to SERVER_WORKER_CLASS. # If using windows, it can be switched to sync or solo. CELERY_WORKER_CLASS=gevent # Request handling timeout. The default is 200, # it is recommended to set it to 360 to support a longer sse connection time. GUNICORN_TIMEOUT=360 # The number of Celery workers. The default is 1, and can be set as needed. CELERY_WORKER_AMOUNT=8 # Flag indicating whether to enable autoscaling of Celery workers. # # Autoscaling is useful when tasks are CPU intensive and can be dynamically # allocated and deallocated based on the workload. # # When autoscaling is enabled, the maximum and minimum number of workers can # be specified. The autoscaling algorithm will dynamically adjust the number # of workers within the specified range. # # Default is false (i.e., autoscaling is disabled). # # Example: # CELERY_AUTO_SCALE=true CELERY_AUTO_SCALE=true # The maximum number of Celery workers that can be autoscaled. # This is optional and only used when autoscaling is enabled. # Default is not set. CELERY_MAX_WORKERS=32 # The minimum number of Celery workers that can be autoscaled. # This is optional and only used when autoscaling is enabled. # Default is not set. CELERY_MIN_WORKERS=2 # API Tool configuration API_TOOL_DEFAULT_CONNECT_TIMEOUT=10 API_TOOL_DEFAULT_READ_TIMEOUT=60 # ------------------------------- # Datasource Configuration # -------------------------------- ENABLE_WEBSITE_JINAREADER=true ENABLE_WEBSITE_FIRECRAWL=true ENABLE_WEBSITE_WATERCRAWL=true # ------------------------------ # Database Configuration # The database uses PostgreSQL. Please use the public schema. # It is consistent with the configuration in the 'db' service below. # ------------------------------ DB_USERNAME=postgres DB_PASSWORD=difyai123456 DB_HOST=db DB_PORT=5432 DB_DATABASE=dify # The size of the database connection pool. # The default is 30 connections, which can be appropriately increased. SQLALCHEMY_POOL_SIZE=250 # Database connection pool recycling time, the default is 3600 seconds. SQLALCHEMY_POOL_RECYCLE=3600 # Whether to print SQL, default is false. SQLALCHEMY_ECHO=false # If True, will test connections for liveness upon each checkout SQLALCHEMY_POOL_PRE_PING=false # Whether to enable the Last in first out option or use default FIFO queue if is false SQLALCHEMY_POOL_USE_LIFO=false # Maximum number of connections to the database # Default is 100 # # Reference: https://www.postgresql.org/docs/current/runtime-config-connection.html#GUC-MAX-CONNECTIONS POSTGRES_MAX_CONNECTIONS=500 # Sets the amount of shared memory used for postgres's shared buffers. # Default is 128MB # Recommended value: 25% of available memory # Reference: https://www.postgresql.org/docs/current/runtime-config-resource.html#GUC-SHARED-BUFFERS POSTGRES_SHARED_BUFFERS=32768MB # Sets the amount of memory used by each database worker for working space. # Default is 4MB # # Reference: https://www.postgresql.org/docs/current/runtime-config-resource.html#GUC-WORK-MEM POSTGRES_WORK_MEM=64MB # Sets the amount of memory reserved for maintenance activities. # Default is 64MB # # Reference: https://www.postgresql.org/docs/current/runtime-config-resource.html#GUC-MAINTENANCE-WORK-MEM POSTGRES_MAINTENANCE_WORK_MEM=512MB # Sets the planner's assumption about the effective cache size. # Default is 4096MB # # Reference: https://www.postgresql.org/docs/current/runtime-config-query.html#GUC-EFFECTIVE-CACHE-SIZE POSTGRES_EFFECTIVE_CACHE_SIZE=65536MB # ------------------------------ # Redis Configuration # This Redis configuration is used for caching and for pub/sub during conversation. # ------------------------------ REDIS_HOST=redis REDIS_PORT=6379 REDIS_USERNAME= REDIS_PASSWORD=difyai123456 REDIS_USE_SSL=false # SSL configuration for Redis (when REDIS_USE_SSL=true) REDIS_SSL_CERT_REQS=CERT_NONE # Options: CERT_NONE, CERT_OPTIONAL, CERT_REQUIRED REDIS_SSL_CA_CERTS= # Path to CA certificate file for SSL verification REDIS_SSL_CERTFILE= # Path to client certificate file for SSL authentication REDIS_SSL_KEYFILE= # Path to client private key file for SSL authentication REDIS_DB=0 # Whether to use Redis Sentinel mode. # If set to true, the application will automatically discover and connect to the master node through Sentinel. REDIS_USE_SENTINEL=false # List of Redis Sentinel nodes. If Sentinel mode is enabled, provide at least one Sentinel IP and port. # Format: `<sentinel1_ip>:<sentinel1_port>,<sentinel2_ip>:<sentinel2_port>,<sentinel3_ip>:<sentinel3_port>` REDIS_SENTINELS= REDIS_SENTINEL_SERVICE_NAME= REDIS_SENTINEL_USERNAME= REDIS_SENTINEL_PASSWORD= REDIS_SENTINEL_SOCKET_TIMEOUT=0.1 # List of Redis Cluster nodes. If Cluster mode is enabled, provide at least one Cluster IP and port. # Format: `<Cluster1_ip>:<Cluster1_port>,<Cluster2_ip>:<Cluster2_port>,<Cluster3_ip>:<Cluster3_port>` REDIS_USE_CLUSTERS=false REDIS_CLUSTERS= REDIS_CLUSTERS_PASSWORD= # ------------------------------ # Celery Configuration # ------------------------------ # Use standalone redis as the broker, and redis db 1 for celery broker. (redis_username is usually set by defualt as empty) # Format as follows: `redis://<redis_username>:<redis_password>@<redis_host>:<redis_port>/<redis_database>`. # Example: redis://:difyai123456@redis:6379/1 # If use Redis Sentinel, format as follows: `sentinel://<redis_username>:<redis_password>@<sentinel_host1>:<sentinel_port>/<redis_database>` # For high availability, you can configure multiple Sentinel nodes (if provided) separated by semicolons like below example: # Example: sentinel://:difyai123456@localhost:26379/1;sentinel://:difyai12345@localhost:26379/1;sentinel://:difyai12345@localhost:26379/1 CELERY_BROKER_URL=redis://:difyai123456@redis:6379/1 CELERY_BACKEND=redis BROKER_USE_SSL=false # If you are using Redis Sentinel for high availability, configure the following settings. CELERY_USE_SENTINEL=false CELERY_SENTINEL_MASTER_NAME= CELERY_SENTINEL_PASSWORD= CELERY_SENTINEL_SOCKET_TIMEOUT=0.1 # Celery schedule tasks configuration ENABLE_CLEAN_EMBEDDING_CACHE_TASK=false ENABLE_CLEAN_UNUSED_DATASETS_TASK=false ENABLE_CREATE_TIDB_SERVERLESS_TASK=false ENABLE_UPDATE_TIDB_SERVERLESS_STATUS_TASK=false ENABLE_CLEAN_MESSAGES=false ENABLE_MAIL_CLEAN_DOCUMENT_NOTIFY_TASK=false ENABLE_DATASETS_QUEUE_MONITOR=false ENABLE_CHECK_UPGRADABLE_PLUGIN_TASK=true Sandbox: drwxr-xr-x 2 root root 4096 Sep 22 20:53 conf drwxr-xr-x 2 root root 4096 Aug 27 16:44 dependencies drwxrwxrwx 2 root root 4096 Aug 20 00:33 file [root@VM-0-11-centos sandbox]# cd conf/ [root@VM-0-11-centos conf]# ll total 8 -rw-r--r-- 1 root root 2091 Sep 22 20:53 config.yaml -rw-r--r-- 1 root root 762 Aug 19 23:31 config.yaml.example [root@VM-0-11-centos conf]# vim config.yaml app: port: 8194 debug: True key: dify-sandbox max_workers: 65 max_requests: 200 worker_timeout: 60 python_path: /usr/local/bin/python3 enable_network: True # please make sure there is no network risk in your environment allowed_syscalls: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336] proxy: socks5: '' http: '' https: '' workflow: ``` <img width="693" height="42" alt="Image" src="https://github.com/user-attachments/assets/6a7ca8cd-fde2-49db-b1ba-a38eab7a6cc9" /> The search tool contains iterations and numerous code nodes: <img width="693" height="78" alt="Image" src="https://github.com/user-attachments/assets/8c66c18d-0a6a-44fa-b3d5-47ec6f997d0e" /> I think a simple 100 users should be perfectly manageable, but it keeps giving me this error:: <img width="554" height="135" alt="Image" src="https://github.com/user-attachments/assets/650e9489-65b2-4b45-9159-a768de015850" /> <img width="570" height="195" alt="Image" src="https://github.com/user-attachments/assets/574722e2-5a18-4c10-974e-b70dcfa23a4b" /> Could it be that dify can't handle this amount of traffic? I don't think it's possible, or is there something wrong with my configuration? I'd appreciate someone familiar with dify or service architecture to help me review this complete configuration, which already meets my concurrent access requirements!
yindo added the 🙋‍♂️ question🌚 invalid labels 2026-02-21 19:41:27 -05:00
yindo closed this issue 2026-02-21 19:41:27 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#17927