From 38aacc311360ee2f6b82011ce6c2bcff4a7d1310 Mon Sep 17 00:00:00 2001 From: wizardchen Date: Fri, 10 Jul 2026 14:48:54 +0800 Subject: [PATCH] chore(env): update WEKNORA_MODEL_MAX_CONCURRENCY to 32 in configuration files Increase the default value of WEKNORA_MODEL_MAX_CONCURRENCY from 8 to 32 in .env.example, docker-compose.yml, and related application code. This change enhances the concurrency limit for background tasks, ensuring better performance and resource management across the system. --- .env.example | 2 +- docker-compose.yml | 2 +- internal/application/service/system_setting.go | 6 +++--- internal/container/container.go | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.env.example b/.env.example index abaac4c7..2260bfd4 100644 --- a/.env.example +++ b/.env.example @@ -732,7 +732,7 @@ DOCREADER_TRANSPORT=grpc # management still apply). Also settable in the management UI under # Settings → System settings (model.max_concurrency); UI changes take effect # immediately without a restart. -# WEKNORA_MODEL_MAX_CONCURRENCY=8 +# WEKNORA_MODEL_MAX_CONCURRENCY=32 # Read/write timeout (in milliseconds) the asynq client uses against Redis. # Default 500ms (writes scale to 1000ms). Bump if you see "i/o timeout" diff --git a/docker-compose.yml b/docker-compose.yml index 0a622401..cbafcd47 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -194,7 +194,7 @@ services: - WEKNORA_TENANT_MAX_OWNED_PER_USER=${WEKNORA_TENANT_MAX_OWNED_PER_USER:-} - WEKNORA_ASYNQ_CONCURRENCY=${WEKNORA_ASYNQ_CONCURRENCY:-32} - WEKNORA_WIKI_ASYNQ_CONCURRENCY=${WEKNORA_WIKI_ASYNQ_CONCURRENCY:-16} - - WEKNORA_MODEL_MAX_CONCURRENCY=${WEKNORA_MODEL_MAX_CONCURRENCY:-8} + - WEKNORA_MODEL_MAX_CONCURRENCY=${WEKNORA_MODEL_MAX_CONCURRENCY:-32} - APK_MIRROR_ARG=${APK_MIRROR_ARG:-} - WEKNORA_BOOTSTRAP_SYSTEM_ADMIN_EMAIL=${WEKNORA_BOOTSTRAP_SYSTEM_ADMIN_EMAIL:-} depends_on: diff --git a/internal/application/service/system_setting.go b/internal/application/service/system_setting.go index e7826ce0..ffdc42ff 100644 --- a/internal/application/service/system_setting.go +++ b/internal/application/service/system_setting.go @@ -200,12 +200,12 @@ var registry = map[string]settingSpec{ // limiter governor; a runtime bridge (applyModelMaxConcurrency) pushes UI // edits into limiter.SetGlobalLimit so no restart is needed. Individual // models may override this via their own max_concurrency parameter. - // Mirrors WEKNORA_MODEL_MAX_CONCURRENCY (default 8). 0/negative disables + // Mirrors WEKNORA_MODEL_MAX_CONCURRENCY (default 32). 0/negative disables // the default cap. "model.max_concurrency": { Type: "int", EnvName: "WEKNORA_MODEL_MAX_CONCURRENCY", - Default: int64(8), + Default: int64(32), Category: "worker", Description: "后台任务(文档入库/富化)对单个模型的默认并发上限,按模型 ID 全副本共享。" + "每次调用实时读取,修改后立即生效、无需重启。0 或负数表示关闭默认限制" + @@ -448,7 +448,7 @@ func (s *systemSettingService) applySSRFWhitelist(ctx context.Context) { // Called at preload (initial sync), after Update (this replica's edit), and // after reload (peer's edit via pubsub). func (s *systemSettingService) applyModelMaxConcurrency(ctx context.Context) { - limit := int(s.GetInt(ctx, "model.max_concurrency", "WEKNORA_MODEL_MAX_CONCURRENCY", 8)) + limit := int(s.GetInt(ctx, "model.max_concurrency", "WEKNORA_MODEL_MAX_CONCURRENCY", 32)) limiter.SetGlobalLimit(limit) logger.Infof(ctx, "[system_settings] model.max_concurrency applied (limit=%d)", limit) } diff --git a/internal/container/container.go b/internal/container/container.go index 0fdb8e27..df1a5997 100644 --- a/internal/container/container.go +++ b/internal/container/container.go @@ -449,7 +449,7 @@ func initLangfuse() (*langfuse.Manager, error) { // model.max_concurrency is unset. summary / question / graph enrichment all // share the same model, so this bounds their combined pressure on one provider // across every replica. Interactive chat is never gated. -const defaultModelMaxConcurrency = 8 +const defaultModelMaxConcurrency = 32 // resolveModelMaxConcurrency reads the per-model background concurrency limit // from system settings / env, defaulting to defaultModelMaxConcurrency when