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.
This commit is contained in:
+1
-1
@@ -732,7 +732,7 @@ DOCREADER_TRANSPORT=grpc
|
|||||||
# management still apply). Also settable in the management UI under
|
# management still apply). Also settable in the management UI under
|
||||||
# Settings → System settings (model.max_concurrency); UI changes take effect
|
# Settings → System settings (model.max_concurrency); UI changes take effect
|
||||||
# immediately without a restart.
|
# 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.
|
# Read/write timeout (in milliseconds) the asynq client uses against Redis.
|
||||||
# Default 500ms (writes scale to 1000ms). Bump if you see "i/o timeout"
|
# Default 500ms (writes scale to 1000ms). Bump if you see "i/o timeout"
|
||||||
|
|||||||
+1
-1
@@ -194,7 +194,7 @@ services:
|
|||||||
- WEKNORA_TENANT_MAX_OWNED_PER_USER=${WEKNORA_TENANT_MAX_OWNED_PER_USER:-}
|
- WEKNORA_TENANT_MAX_OWNED_PER_USER=${WEKNORA_TENANT_MAX_OWNED_PER_USER:-}
|
||||||
- WEKNORA_ASYNQ_CONCURRENCY=${WEKNORA_ASYNQ_CONCURRENCY:-32}
|
- WEKNORA_ASYNQ_CONCURRENCY=${WEKNORA_ASYNQ_CONCURRENCY:-32}
|
||||||
- WEKNORA_WIKI_ASYNQ_CONCURRENCY=${WEKNORA_WIKI_ASYNQ_CONCURRENCY:-16}
|
- 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:-}
|
- APK_MIRROR_ARG=${APK_MIRROR_ARG:-}
|
||||||
- WEKNORA_BOOTSTRAP_SYSTEM_ADMIN_EMAIL=${WEKNORA_BOOTSTRAP_SYSTEM_ADMIN_EMAIL:-}
|
- WEKNORA_BOOTSTRAP_SYSTEM_ADMIN_EMAIL=${WEKNORA_BOOTSTRAP_SYSTEM_ADMIN_EMAIL:-}
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|||||||
@@ -200,12 +200,12 @@ var registry = map[string]settingSpec{
|
|||||||
// limiter governor; a runtime bridge (applyModelMaxConcurrency) pushes UI
|
// limiter governor; a runtime bridge (applyModelMaxConcurrency) pushes UI
|
||||||
// edits into limiter.SetGlobalLimit so no restart is needed. Individual
|
// edits into limiter.SetGlobalLimit so no restart is needed. Individual
|
||||||
// models may override this via their own max_concurrency parameter.
|
// 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.
|
// the default cap.
|
||||||
"model.max_concurrency": {
|
"model.max_concurrency": {
|
||||||
Type: "int",
|
Type: "int",
|
||||||
EnvName: "WEKNORA_MODEL_MAX_CONCURRENCY",
|
EnvName: "WEKNORA_MODEL_MAX_CONCURRENCY",
|
||||||
Default: int64(8),
|
Default: int64(32),
|
||||||
Category: "worker",
|
Category: "worker",
|
||||||
Description: "后台任务(文档入库/富化)对单个模型的默认并发上限,按模型 ID 全副本共享。" +
|
Description: "后台任务(文档入库/富化)对单个模型的默认并发上限,按模型 ID 全副本共享。" +
|
||||||
"每次调用实时读取,修改后立即生效、无需重启。0 或负数表示关闭默认限制" +
|
"每次调用实时读取,修改后立即生效、无需重启。0 或负数表示关闭默认限制" +
|
||||||
@@ -448,7 +448,7 @@ func (s *systemSettingService) applySSRFWhitelist(ctx context.Context) {
|
|||||||
// Called at preload (initial sync), after Update (this replica's edit), and
|
// Called at preload (initial sync), after Update (this replica's edit), and
|
||||||
// after reload (peer's edit via pubsub).
|
// after reload (peer's edit via pubsub).
|
||||||
func (s *systemSettingService) applyModelMaxConcurrency(ctx context.Context) {
|
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)
|
limiter.SetGlobalLimit(limit)
|
||||||
logger.Infof(ctx, "[system_settings] model.max_concurrency applied (limit=%d)", limit)
|
logger.Infof(ctx, "[system_settings] model.max_concurrency applied (limit=%d)", limit)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -449,7 +449,7 @@ func initLangfuse() (*langfuse.Manager, error) {
|
|||||||
// model.max_concurrency is unset. summary / question / graph enrichment all
|
// model.max_concurrency is unset. summary / question / graph enrichment all
|
||||||
// share the same model, so this bounds their combined pressure on one provider
|
// share the same model, so this bounds their combined pressure on one provider
|
||||||
// across every replica. Interactive chat is never gated.
|
// across every replica. Interactive chat is never gated.
|
||||||
const defaultModelMaxConcurrency = 8
|
const defaultModelMaxConcurrency = 32
|
||||||
|
|
||||||
// resolveModelMaxConcurrency reads the per-model background concurrency limit
|
// resolveModelMaxConcurrency reads the per-model background concurrency limit
|
||||||
// from system settings / env, defaulting to defaultModelMaxConcurrency when
|
// from system settings / env, defaulting to defaultModelMaxConcurrency when
|
||||||
|
|||||||
Reference in New Issue
Block a user