jitsi-videobridge load balancing construction

write in front

If we use the official tutorial to quickly install jitsi (including jitsi-meet,prosody,jitsi-videobridge,jicofo,nginx). Yes, the environment is set up, but if the production environment wants to be used by many people, the configuration or load will not be able to support much. There are two officially recommended ways. One is to simply load the jitsi-videobridge (hereinafter referred to as jvb), and the other is to use the proxy to load the entire jitsi-meet. Currently we are using jvb as the load.

What are the benefits of using jvb for load

The reason why we use jvb as a load, we need to know a little basic knowledge of jitsi: what role do jitsi-meet,prosody,jvb,jicofo play in jitsi?

jitsi-meet: front end module, nginx forwarded directly to jitsi-meet

prosody: xmpp Protocol Server Framework,jitsi is based on xmpp

jvb: Video bridge, responsible for all video sharing among various servers

jicofo: Responsible for room management

The official website has an introduction. If we need more audio and video users, we need to increase these numbers:
vim /etc/systemd/system.conf


to make it work:
sudo systemctl daemon-reload
sudo systemctl restart jitsi-videobridge2
Check if it works:

systemctl show --property DefaultLimitNPROC 
systemctl show --property DefaultLimitNOFILE 
systemctl show --property DefaultTasksMax

But when we have more audio and video conference users coming in, maybe this is not enough, then we need to use multiple jvb for load balancing

Install jvb load balancing on multiple ubuntu18

Prerequisite: You are based on the official website tutorial for quick installation
I take two machines as an example, one is built according to the official fast, and one machine is installed with prosody,jicofo,jvb,nginx,jitsi-meet and other machines, abbreviated as JMS, and we also need a clean ubuntu18 The machine, hereinafter referred to as the jitsi-videobridge machine

  • First, we need to update the jvb patch to the latest version
echo 'deb https://download.jitsi.org stable/' >> /etc/apt/sources.list.d/jitsi-stable.list
wget -qO -  https://download.jitsi.org/jitsi-key.gpg.key | apt-key add -
apt-get install apt-transport-https
apt update
apt upgrade
  • Setup firewall on new videobridge server JVB
ufw status
ufw allow ssh
ufw allow 443/tcp
ufw allow 4443/tcp
ufw allow 10000:20000/udp
ufw enable
  • Setting up a firewall on the jitsi-meet server running on JMS on the first instance
ufw allow 5222/tcp
ufw reload
  • Install jitsi-videobridge on the new videobridge server JVB
apt -y install jitsi-videobridge2
  • Enter DNS name from jitsi-meet server (JMS) during installation on JVB

Check out the file at /etc/jitsi/videobridge/configJVB, it should look something like this (note that you don't need to edit it, just make sure you've got it right so far):

# Jitsi Videobridge settings
# sets the XMPP domain (default: none)
JVB_HOSTNAME=<your jitsi-meet domain name which you entered during installation>
# sets the hostname of the XMPP server (default: domain if set, localhost otherwise)
# sets the port of the XMPP server (default: 5275)
# sets the shared secret used to authenticate to the XMPP server
# extra options to pass to the JVB daemon
# adds java system props that are passed to jvb (default are for home and logging config file)
JAVA_SYS_PROPS="-Dnet.java.sip.communicator.SC_HOME_DIR_LOCATION=/etc/jitsi -Dnet.java.sip.communicator.SC_HOME_DIR_NAME=videobridge -Dnet.java.sip.communicator.SC_LOG_DIR_LOCATION=/var/log/jitsi -Djava.util.logging.config.file=/etc/jitsi/videobridge/logging.properties"
  • Copy values ​​from jitsi-meet server (JMS) to JVB server:

Open JMS's file /etc/jitsi/videobridge/sip-communicator.properties, copy everything to clipboard, and paste it into the file in JVB server /etc/jitsi/videobridge/sip-communicator.properties replace where all other files of
The content on JVB should be similar to:

org.jitsi.videobridge.xmpp.user.shard.HOSTNAME=<your jitsi-meet Server as DNS like jitsi.example.tld>
org.jitsi.videobridge.xmpp.user.shard.DOMAIN=auth.<your jitsi-meet Server as DNS like jitsi.example.tld>
org.jitsi.videobridge.xmpp.user.shard.PASSWORD=<secret from JMS - keep it; do not change it>
org.jitsi.videobridge.xmpp.user.shard.MUC_JIDS=JvbBrewery@internal.auth.<your jitsi-meet Server as DNS like jitsi.example.tld>
org.jitsi.videobridge.xmpp.user.shard.MUC_NICKNAME=<any unique name here; important: unique value for each videobridge like "jvb2">
  • The file on the JMS server should look almost the same, only the same as the other MUC_NICKNAME (it's fine to keep it in the installation scope).

Restart videobridge-service on JVB and you should be good to go!

/etc/init.d/jitsi-videobridge2 restart
  • Check to see if everything is OK. The logs are at:
JVB: /var/log/jitsi/jvb.log
JMS: /var/log/jitsi/jvb.log 
  • In the jicofo-log, you should see the connection bridge:
Jicofo INFORMATION: [30] org.jitsi.jicofo.xmpp.BaseBrewery.processInstanceStatusChanged().329 Added brewery instance: jvb
brewery@internal.auth.<your jitsi-domain>/<your JVB NICKNAME like jvb2>
Jicofo INFORMATION: [30] org.jitsi.jicofo.bridge.BridgeSelector.log() Added videobridge: jvbbrewery@internal.auth.<your jitsi-domain>/<your JVB NICKNAME like jvb2> v: null

At this point, the load balancing jvb installation is complete


To simply test the installation, turn off the video bridge on the JMS Server and check that you can still connect to JitsiMeet and videoconference. The Jicofo service will automatically use the available servers.

/etc/init.d/jitsi-videobridge2 stop

At this time, a video bridge jvb has been disabled. You can enter your video conference to see if you can still access it normally. If the setup is successful, you can access it normally.
Well, after the test, remember to restart the video bridge you closed (the same is true for 3 or more jvb s)

/etc/init.d/jitsi-videobridge2 start

Tags: Distribution Load Balance

Posted by tboneuls on Tue, 31 May 2022 22:27:11 +0530