Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How much hosting RAM does a webRTC app require?

I will be hosting a webrtc application. All the server needs to do is just pass around messages like room number, ice candidates, disconnects, etc, just all those messages for signalling. I am using socket.io and node.js.

The server pretty much just passes text around. There is no sign ups, no database, it's all in memory. It keeps track of a list of users that are online (just how many are online), and list of rooms that are taken. So a few lists of numbers, and it passes text between users so that they can connect via webrtc.

Now, obviously when (if) I get a huge amount of traffic coming in, the lists might get kind of big, like maybe 10k-20k 5 digit numbers in each list (there are only a couple big lists).

And all that passing around, like the disconnect and connect. I need a server that can do this stuff fast, perferably a free server. I mean, it's only text, so it shouldn't be that big of a deal, right? But my app is structured around connecting a person to the next person who connects. So, if a whole bunch of people connect at around the same second, then I need a quick hosting server that can handle that to the milisecond... Will this even be a problem?

What exactly should I be looking for in a server, if I'm just using memory for number lists (no databases), and passing around text stuff.

like image 944
Hellothere Avatar asked Apr 21 '15 01:04

Hellothere


1 Answers

First of all, this doesn't have anything to do with webrtc itself. What you basically want is a chat-server, a server that sends data from one client to the other.
Second, the type of server is irrelevant to the amount of RAM required to run it. What matters is how much clients you will have concurrently. (to some extent, game servers will obviously consume more RAM even without clients).
Third, more RAM does NOT mean faster handling. That is, if you don't fully use the available RAM, adding more won't do you any good. Obviously, when you exceed the available RAM things start to slow down a lot. Read more about it here

Now, with those out of the way, let's see what you need. You can make a very rough estimation by connecting a few clients to a server and see how much RAM it uses. Check if the amount of RAM goes up if these clients start calling each other and by how much it goes up. You now have a minimum and a maximum amount of RAM for x clients. I would do this test with about 10 clients.

Now that you can make an estimation, calculate how much the minimum and maximum RAM is for your expected userbase. It will become more and more a preference thing from here on out, but I would at least double that amount and then round up to the nearest amount of RAM that "makes sense" (14.7GB becomes 16GB, 28.32GB becomes 32GB etc...)

I will add, from my own experience with webrtc with about 1000-1500 concurrent users that 8GB is easily enough. But it's really up to the amount of users you expect.

On a side node, I very much recommend nodejs for a server. It's super easy to use, any programmer that knows javascript (so basically any programmer) can create a chat-server in nodejs in a day or two. Take a look at this open-source webrtc server in nodejs

like image 78
Kevin Avatar answered Nov 18 '22 12:11

Kevin