mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-07-24 13:36:24 +00:00
perf: prevent cron job overlap, auto-set GOMEMLIMIT, fix tgbot userStates race
cron: SkipIfStillRunning stops a slow 5s/10s job from overlapping itself and racing the shared xrayAPI (grpc conn leak) and the StatsLastValues map (fatal concurrent map write). memlimit: auto-detect a Go soft memory limit from XUI_MEMORY_LIMIT, the cgroup limit, or system RAM (about 90 percent); opt-in pprof via XUI_PPROF. tgbot: userStates now goes through a mutex-guarded store with TTL pruning (was raced by worker-pool and delayed-delete goroutines). check_client_ip: prefilter inbounds by settings LIKE limitIp instead of loading and JSON-parsing all of them every scan. minor: prune StatsLastValues, RateLimiter.lastSent, reportedRemoteTagConflict. docker-compose: document the memory knobs.
This commit is contained in:
@@ -5,6 +5,9 @@ services:
|
||||
dockerfile: ./Dockerfile
|
||||
container_name: 3xui_app
|
||||
# hostname: yourhostname <- optional
|
||||
# Optional hard memory cap. When set, the panel auto-derives its Go soft
|
||||
# limit (GOMEMLIMIT, ~90%) from this so it GCs before the OOM killer fires.
|
||||
# mem_limit: 512m
|
||||
# The bundled Fail2ban (XUI_ENABLE_FAIL2BAN below) enforces the IP limit
|
||||
# with iptables, which needs NET_ADMIN. Without these caps a ban is logged
|
||||
# and shown in fail2ban status but never actually applied. NET_RAW covers
|
||||
@@ -18,6 +21,11 @@ services:
|
||||
environment:
|
||||
XRAY_VMESS_AEAD_FORCED: "false"
|
||||
XUI_ENABLE_FAIL2BAN: "true"
|
||||
# Go memory soft limit. If neither is set, the panel auto-detects the
|
||||
# cgroup/host limit and targets ~90%. Pin it explicitly with one of:
|
||||
# XUI_MEMORY_LIMIT: "400" # in MiB
|
||||
# GOMEMLIMIT: "400MiB" # Go syntax, takes precedence
|
||||
# XUI_PPROF: "true" # expose pprof on 127.0.0.1:6060 for profiling
|
||||
# XUI_INIT_WEB_BASE_PATH: "/"
|
||||
# XUI_PORT: "8080"
|
||||
# To use PostgreSQL instead of the default SQLite, run:
|
||||
|
||||
Reference in New Issue
Block a user