[__jitsi_meet] Adapt jicofo and videobridge memory usage
This enables us to setup smaller jitsi instances that work reliably. We set 3 threshholds: - < 3G RAM: use 0.75G max memory - < 5G RAM: use 1G max memory - < 8G RAM: use 2G max memory - >= 8G RAM: use 3G max memory (jitsi's default) For more information as to why and how this is done, see: https://gitlab.com/guifi-exo/projectes/-/issues/318 https://github.com/jitsi/jitsi-meet/issues/6589 as investigated back in the day by @pedro Sponsored by: camilion.eu, eXO.cat
This commit is contained in:
parent
87cc109bf1
commit
80bbbd3aa8
3 changed files with 50 additions and 0 deletions
15
type/__jitsi_meet/explorer/configured-memory
Executable file
15
type/__jitsi_meet/explorer/configured-memory
Executable file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/sh -eu
|
||||||
|
|
||||||
|
JICOFO="/usr/share/jicofo/jicofo.sh"
|
||||||
|
VIDEOBRIDGE="/usr/share/jitsi-videobridge/lib/videobridge.rc"
|
||||||
|
|
||||||
|
if [ -f "${JICOFO:?}" ]; then
|
||||||
|
jicofo_memory="$(grep JICOFO_MAX_MEMORY= "${JICOFO:?}" | cut -d= -f 2 | cut -d ";" -f 1)"
|
||||||
|
fi
|
||||||
|
if [ -f "${VIDEOBRIDGE:?}" ]; then
|
||||||
|
vb_memory="$(grep VIDEOBRIDGE_MAX_MEMORY= "${VIDEOBRIDGE:?}" | cut -d= -f 2)"
|
||||||
|
fi
|
||||||
|
cat <<EOF
|
||||||
|
jicofo ${jicofo_memory:-n/a}
|
||||||
|
videobridge ${vb_memory:-n/a}
|
||||||
|
EOF
|
|
@ -1,10 +1,43 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
memory="$(cat "${__global}/explorer/memory")"
|
||||||
|
G="000000" # Will totally eff up the zero-count otherwise
|
||||||
|
# MAX_MEMORY will affect jicofo and videobridge
|
||||||
|
# As a rule of thumb, the machine's RAM should be more than 2.5 * MAX_MEMORY
|
||||||
|
if [ "${memory}" -lt "3${G}" ]; then
|
||||||
|
# If you use this, let us know how it works!
|
||||||
|
MAX_MEMORY="768m"
|
||||||
|
elif [ "${memory}" -lt "5${G}" ]; then
|
||||||
|
MAX_MEMORY="1024m"
|
||||||
|
elif [ "${memory}" -lt "8${G}" ]; then
|
||||||
|
MAX_MEMORY="2048m"
|
||||||
|
else
|
||||||
|
# Jitsi recommends running on 8G RAM and these are the defaults
|
||||||
|
MAX_MEMORY="3072m"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if cut -f 2 "${__object}/explorer/configured-memory" | grep -qvE "^${MAX_MEMORY}$"; then
|
||||||
|
# At least one service has different memory settings
|
||||||
|
RESTART_SERVICES="YES"
|
||||||
|
cat <<-EOF
|
||||||
|
sed -i.tmp -E \
|
||||||
|
-e 's!^(#[[:space:]]*)?(VIDEOBRIDGE_MAX_MEMORY)=.*\$!\2=${MAX_MEMORY}!' \
|
||||||
|
/usr/share/jitsi-videobridge/lib/videobridge.rc
|
||||||
|
sed -i.tmp -E \
|
||||||
|
-e 's!^(JICOFO_MAX_MEMORY)[^;]+;!\1=${MAX_MEMORY};!' \
|
||||||
|
/usr/share/jicofo/jicofo.sh
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
if grep -qE "^__file/etc/nginx" "${__messages_in}"; then
|
if grep -qE "^__file/etc/nginx" "${__messages_in}"; then
|
||||||
echo "service nginx reload"
|
echo "service nginx reload"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if grep -qE "^(__line/jitsi_jicofo_secured_domains|(__file|__link)/etc/prosody/conf.d/|__file/etc/jitsi/jicofo/jicofo.conf)" "${__messages_in}"; then
|
if grep -qE "^(__line/jitsi_jicofo_secured_domains|(__file|__link)/etc/prosody/conf.d/|__file/etc/jitsi/jicofo/jicofo.conf)" "${__messages_in}"; then
|
||||||
|
RESTART_SERVICES="YES"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "${RESTART_SERVICES}" ]; then
|
||||||
echo "systemctl restart prosody"
|
echo "systemctl restart prosody"
|
||||||
echo "systemctl restart jicofo"
|
echo "systemctl restart jicofo"
|
||||||
echo "systemctl restart jitsi-videobridge2"
|
echo "systemctl restart jitsi-videobridge2"
|
||||||
|
|
|
@ -36,6 +36,8 @@ If you can, please contribute updates to `__jitsi_meet` and
|
||||||
Alternatively, you can help finance that work; get in touch with the type
|
Alternatively, you can help finance that work; get in touch with the type
|
||||||
authors for that (see below).
|
authors for that (see below).
|
||||||
|
|
||||||
|
This type takes care of adapting the maximum memory used by jicofo and
|
||||||
|
videobridge in function of the hosts installed memory.
|
||||||
|
|
||||||
NOTE: This type currently does not deal with setting up coturn.
|
NOTE: This type currently does not deal with setting up coturn.
|
||||||
For that, you might want to check `__coturn` in
|
For that, you might want to check `__coturn` in
|
||||||
|
|
Loading…
Reference in a new issue