mirror of
https://github.com/hansjone/netx.git
synced 2026-10-09 02:00:46 +08:00
Raise runtime defaults for multi-user shared-server deployments.
Size DB pool, CLI budget, and WebCRT session caps for concurrent operators while keeping hard ceilings and env overrides. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
fa577aa3bd
commit
e0503df8a5
16 changed files with 87 additions and 85 deletions
|
|
@ -12,12 +12,13 @@ _log = logging.getLogger("netx.runtime.budget")
|
|||
|
||||
def log_runtime_budget(*, role: str = "api") -> None:
|
||||
"""Log effective pools/CLI caps and warn when capacity looks undersized."""
|
||||
pool_size = max(1, int(getattr(settings, "db_pool_size", 25) or 25))
|
||||
overflow = max(0, int(getattr(settings, "db_max_overflow", 15) or 15))
|
||||
pool_size = max(1, int(getattr(settings, "db_pool_size", 40) or 40))
|
||||
overflow = max(0, int(getattr(settings, "db_max_overflow", 40) or 40))
|
||||
pool_cap = pool_size + overflow
|
||||
cli = max(1, int(getattr(settings, "cli_max_concurrent", 12) or 12))
|
||||
cli = max(1, int(getattr(settings, "cli_max_concurrent", 24) or 24))
|
||||
hard = feature_hard_cap()
|
||||
http_reserve = 8 # rough floor for request handlers + UME WS bursts
|
||||
# Multi-user HTTP + WebCRT WS + UME alarm WS headroom.
|
||||
http_reserve = 24
|
||||
recommended_pool = cli + http_reserve
|
||||
|
||||
_log.info(
|
||||
|
|
@ -29,10 +30,10 @@ def log_runtime_budget(*, role: str = "api") -> None:
|
|||
pool_cap,
|
||||
cli,
|
||||
hard,
|
||||
int(getattr(settings, "cli_timeout_pool_workers", 12) or 12),
|
||||
int(getattr(settings, "port_traffic_dispatch_workers", 3) or 3),
|
||||
int(getattr(settings, "webcrt_max_sessions", 12) or 12),
|
||||
int(getattr(settings, "audit_sample_n", 10) or 10),
|
||||
int(getattr(settings, "cli_timeout_pool_workers", 24) or 24),
|
||||
int(getattr(settings, "port_traffic_dispatch_workers", 6) or 6),
|
||||
int(getattr(settings, "webcrt_max_sessions", 40) or 40),
|
||||
int(getattr(settings, "audit_sample_n", 5) or 5),
|
||||
bool(getattr(settings, "run_inline_schedulers", True)),
|
||||
)
|
||||
_log.info("runtime budget snapshot pool=%s cli=%s", db_pool_status(), cli_budget_status())
|
||||
|
|
@ -51,7 +52,7 @@ def log_runtime_budget(*, role: str = "api") -> None:
|
|||
getattr(settings, "run_inline_schedulers", True)
|
||||
):
|
||||
_log.warning(
|
||||
"Non-loopback bind (%s) with inline schedulers — for production prefer "
|
||||
"Non-loopback bind (%s) with inline schedulers — for multi-user production prefer "
|
||||
"NETX_RUN_INLINE_SCHEDULERS=false and `python -m netx_api.worker`.",
|
||||
host,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue