horizontally scaling the janus gateway

3,547 views
Skip to first unread message

Wilbert Jackson

unread,
Mar 2, 2015, 8:02:51 AM3/2/15
to meetech...@googlegroups.com
Anyone know or have ideas of the how the janus gateway can be scaled horizontally as more users access the gateway?

Thanks

Wilbert Jackson 

Nicholas Wylie

unread,
Mar 2, 2015, 3:16:50 PM3/2/15
to meetech...@googlegroups.com
Establishing a WebRTC connection between two Janus instances would probably be the easiest way? If you can have one Janus gateway act as a peer to another, most of the plugins should continue to function as expected.

Short of that you could setup a direct UDP connection between plugins in different instances of Janus to do a similar job, but that's likely more difficult and less robust.

Travis James

unread,
Mar 2, 2015, 4:36:48 PM3/2/15
to meetech...@googlegroups.com
Wouldn't there need to be some collaboration on signalling that might require some pub/sub via Redis to keep sessions and messages in sync, or soes the "peer" function take care of that?

Nicholas Wylie

unread,
Mar 2, 2015, 5:00:55 PM3/2/15
to meetech...@googlegroups.com
Yes, you would probably need something between the two Janus instances for signally purposes. The media side of things should "Just Work" however.

Lorenzo or somebody else can probably pitch in and correct me, but this is what I imagine you would need to implement this in practice:
  • Modify the plugins to have some kind of a "Call Me" function, where Janus initiates the connection establishment process and returns an SDP offer
  • Setup a signalling server that can handle the API flow between the two different Janus instances
  • Signalling server creates handles on each of the Janus instances
  • Signalling server calls the "Call Me" function on one of the instances
  • Signalling server forwards the SDP offer to the other Janus instance
  • Signalling server handles any other message flow related to the plugins afterwards.
The tricky part is handling the plugin specific messages flowing between the instances, as these are specific to the plugin. The actual session/handle creation shouldn't be difficult to do in the signalling server.

Sharath Kumar

unread,
Mar 2, 2015, 5:20:21 PM3/2/15
to meetech...@googlegroups.com
Wilbert, 

I am just using nginx and mysqldb to loadbalance amongst various Janus instances running on different machines. The idea is when I create the session the NginX writes the association of a janus session and IP address of the machine. So now all requests to that session from any nginx(they share the same db) goes to the same Janus instance. session creation is round robin load-balanced and session partcipants will join the same session from anywhere but will land on the Janus that originally created the session.

HTH
Sharath

Gatecrasher777

unread,
Mar 2, 2015, 5:21:45 PM3/2/15
to meetech...@googlegroups.com
In a multi-room videoroom environment, it should be quite easy to scale horizontally, since your front end and the Janus servers don't have to be on the same machine.  It would just be the case that you would load-balance across Janus servers when new rooms are created. Its only important that a specific room stays on a specific server. 

Wilbert Jackson

unread,
Mar 4, 2015, 9:04:36 AM3/4/15
to meetech...@googlegroups.com
Thanks to all for architecture ideas. We are trying out Nginx, Cassandra DB, Redis, and Socket.io to scale Janus. As well, we need to scale a distributed network monitoring service (nodjs, Socket.io based) we have developed that monitors network usage and cpu stats for all Janus instances and room sessions. Stats collected are pushed to an HTML5 dashboard app that renders stats for all Janus instances in 3D, 2D views. Using Nginx, Cassandra DB, Redis and Socket.io seems like a good choose to accomodate all our server scaling needs.

wilbert jackson

ChihYen Chen

unread,
May 21, 2015, 6:39:59 AM5/21/15
to meetech...@googlegroups.com
Wilbert,

Do you setup an nodjs server monitoring service on each server?
Or there are some way to monitor the remote janus instance's cpu and network usage?
Thanks!

ChihYen(Jam).

Wilbert Jackson於 2015年3月4日星期三 UTC+8下午10時04分36秒寫道:

Wilbert Jackson

unread,
May 21, 2015, 8:37:21 AM5/21/15
to meetech...@googlegroups.com
Hello,

 In our HTML5 Javascript based app we use the WebRTC getstats call to monitor network congestion bandwidth, encoding bit rate, etc. data values for each client app to janus server connection. The client app sends the getstat data to a nodejs server. On a Janus server, and tablets that run our app, we use an application we developed to monitor network bandwidth, CPU utilization, and memory usage data which gets sent to a nodejs server. As well, our app uses a nodejs proxy server to make and track Janus api call data.

wilbert jackson

ChihYen Chen

unread,
May 21, 2015, 10:40:28 AM5/21/15
to meetech...@googlegroups.com
Wilbert,
Thanks for your quick and detailed reply, I will give it a try!  :)
Sincerely,
ChihYen(Jam)

Fedot Serghei

unread,
Nov 12, 2020, 5:48:32 AM11/12/20
to meetecho-janus
Hello, I'm interested how you build your infrastucture.How do you integrate socket.io-redis and janus? Do you use socket.io and redis just for monitoring?

Fedot Serghei

unread,
Nov 12, 2020, 6:05:54 AM11/12/20
to meetecho-janus
Hello, I'm missing a last piece,  are you using any sql database? or just Nginx and Janus instances?
Reply all
Reply to author
Forward
0 new messages