mirror of
https://github.com/fluxerapp/fluxer.git
synced 2026-09-02 21:04:06 +03:00
fix(gateway): clamp the derived BEAM scheduler count (#2243)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user