fix(gateway): clamp the derived BEAM scheduler count (#2243)

This commit is contained in:
Hampus
2026-08-31 15:29:58 +02:00
committed by GitHub
parent 0a4f6ff9fb
commit 8c3e3285f7
2 changed files with 23 additions and 1 deletions
+7
View File
@@ -106,3 +106,10 @@ FLUXER_DISCOVERY_ENABLED=true
# durable state elsewhere.
#FLUXER_VALKEY_MAXMEMORY=192mb
#FLUXER_VALKEY_MAXMEMORY_POLICY=noeviction
# The gateway derives its BEAM scheduler count from the container CPU quota,
# clamped to this range. The floor matters: a single scheduler lets one blocking
# operation stall every websocket on the node. The ceiling stops a large host
# from starting far more schedulers than the container can actually use.
#FLUXER_ERLANG_SCHEDULERS_MIN=2
#FLUXER_ERLANG_SCHEDULERS_MAX=16
+16 -1
View File
@@ -37,12 +37,27 @@ available_cpu_count() {
fi
}
clamp_int() {
value="$1"
min="$2"
max="$3"
if [ "$value" -lt "$min" ]; then
value="$min"
fi
if [ "$value" -gt "$max" ]; then
value="$max"
fi
echo "$value"
}
: "${FLUXER_ERLANG_SCHEDULERS_MIN:=2}"
: "${FLUXER_ERLANG_SCHEDULERS_MAX:=16}"
: "${FLUXER_ERLANG_NODE_NAME:=fluxer_gateway@127.0.0.1}"
: "${FLUXER_ERLANG_COOKIE:=fluxer_gateway_dev_cookie}"
: "${FLUXER_ERLANG_DIST_PORT:=8081}"
if ! is_positive_int "${FLUXER_ERLANG_SCHEDULERS:-}"; then
FLUXER_ERLANG_SCHEDULERS="$(available_cpu_count)"
FLUXER_ERLANG_SCHEDULERS="$(clamp_int "$(available_cpu_count)" "$FLUXER_ERLANG_SCHEDULERS_MIN" "$FLUXER_ERLANG_SCHEDULERS_MAX")"
fi
if ! is_positive_int "${FLUXER_ERLANG_DIRTY_CPU_SCHEDULERS:-}"; then