mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-07 19:22:14 +09: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.
|
# durable state elsewhere.
|
||||||
#FLUXER_VALKEY_MAXMEMORY=192mb
|
#FLUXER_VALKEY_MAXMEMORY=192mb
|
||||||
#FLUXER_VALKEY_MAXMEMORY_POLICY=noeviction
|
#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
|
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:[email protected]}"
|
: "${FLUXER_ERLANG_NODE_NAME:[email protected]}"
|
||||||
: "${FLUXER_ERLANG_COOKIE:=fluxer_gateway_dev_cookie}"
|
: "${FLUXER_ERLANG_COOKIE:=fluxer_gateway_dev_cookie}"
|
||||||
: "${FLUXER_ERLANG_DIST_PORT:=8081}"
|
: "${FLUXER_ERLANG_DIST_PORT:=8081}"
|
||||||
|
|
||||||
if ! is_positive_int "${FLUXER_ERLANG_SCHEDULERS:-}"; then
|
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
|
fi
|
||||||
|
|
||||||
if ! is_positive_int "${FLUXER_ERLANG_DIRTY_CPU_SCHEDULERS:-}"; then
|
if ! is_positive_int "${FLUXER_ERLANG_DIRTY_CPU_SCHEDULERS:-}"; then
|
||||||
|
|||||||
Reference in New Issue
Block a user