Scale biz_state collects with dedicated workers and non-blocking UI poll.

Add PG claim/NE mutex, persist pool, and biz_state_worker replicas; fix double-SSH and row-count bugs; stop 32m collectNow while-loop from freezing page switches.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-09-22 17:00:37 +08:00
parent 0eb65a839e
commit 3a0de0d7fb
22 changed files with 1210 additions and 165 deletions

View file

@ -66,6 +66,15 @@ NETX_UME_NOTIFICATION_TOPIC=ALARM
# (start_netx.ps1/.sh do this automatically). Worker writes heartbeat for API /metrics.
# NETX_RUN_INLINE_SCHEDULERS=false
# NETX_SCHEDULER_HEARTBEAT_PATH=data/runtime/scheduler_heartbeat.json
# Biz-state dedicated workers (default on with split start): claim queued batches via PG.
# Rule of thumb: NETX_BIZ_STATE_MAX_CONCURRENT_TASKS * 2 <= NETX_CLI_MAX_CONCURRENT
# NETX_BIZ_STATE_DEDICATED_WORKERS=true
# NETX_BIZ_STATE_MAX_CONCURRENT_TASKS=16
# NETX_BIZ_STATE_WORKER_COLLECT_THREADS=8
# NETX_BIZ_STATE_PERSIST_WORKERS=4
# NETX_BIZ_STATE_WORKER_REPLICAS=2
# NETX_BIZ_STATE_SPOOL_DIR=data/biz_state_spool
# NETX_BIZ_STATE_PERSIST_EVERY_CMDS=8
# --- Multi-user shared-server capacity (defaults in Settings already match these) ---
# NETX_DB_POOL_SIZE=40
# NETX_DB_MAX_OVERFLOW=40
@ -94,6 +103,6 @@ NETX_UME_NOTIFICATION_TOPIC=ALARM
# NETX_NE_COLLECTION_KEEP_DAYS=14
# Heavier fleets: raise CLI/DB together; also ensure Postgres max_connections and bastion session limits.
# One-click start (recommended): .\scripts\start_netx.ps1 -Background -WithWeb
# -> API with NETX_RUN_INLINE_SCHEDULERS=false + auto-started netx_api.worker + optional Vite
# -> API + netx_api.worker + N× netx_api.biz_state_worker + optional Vite
# Legacy single-process: add -InlineSchedulers
# Stop all: .\scripts\stop_netx.ps1