The log means that there is no free bindable UDP port in the range you provided to the worker. Meaning the ports are not bindable or already in use. You need to provide a wide enough port range to the worker to avoid an early exhaustion.
In any case, check such ports usage in your system by the time you get the log.
Does that mean even though with powerfull CPU mediasoup can only handle number of users per server due to limitation in port. i recently faced this problem in prod. even though I was using wide range of port. I was showing off that mediasoup based voice server can handle any number of people but then suddenly server started giving this error. mediasoup:ERROR:Channel [pid:85251 RTC::PortManager::Bind() | throwing MediaSoupError: no more available ports [transport:udp, ip:'0.0.0.0', numAttempt:2]
but also I read in docs that even though we can fire up new ec2 instance when I create a transport to that server it binds the port.so I end up with limited users per port. is there any workaround for this ?. I don’t care about performance for now as I am using very low resolution and very low frame rate. i just want lots of users on single server more than 50,000 at least.
Actually i am using 40000 to 49999. but I just wanted to see how my ec2 performs in large audience. but CPU was still at very low which was good but as soon as another member arrived in one the space mediasoup start giving warnings. I am closing all the ports. just that my audience was very large. we were doing a local community conference were large number of people joined in conference room.
so started looking into docs. and then I realized that transports are binding to ports.
but I wanted to have large number of people with different rooms in one instance so that I don’t have to code for router.pitetorouter to another worker.
These ports can only handle around 9999 transports, you need to provide more ports to handle more transports or you can try new version of mediasoup which uses ports per worker rather than per transport, you can read more about it here:
Oh Is that so . i am using 3.10.3. I have to look into this. so what is the ideal solution here? because let’s say 0 to 65535 ports are there then also per worker we can only supply to 65535 users only. which is very low
No, 1 worker uses 1 port. And on 1 worker you can handle n number of consumers based upon the core capacity of your CPU as each worker runs on it’s core. So if 1 core of you cpu can handle 1500 consumers and you have 32 cores which means you should create max 32 workers then below is the math:
So your CPU with that capacity can handle around 48000 consumers. But in reality actual number of consumers can be lower than this because of the piping, if you are doing, and some other stuff of your server.
You can calculate the number of consumers in your call session and see the max number of users your CPU can handle
@zaidiqbalsoftech this is awesome. I did upgrade mediasoup 3.10.3 but didn’t checked what you just shared me. i coded that thing and even with one port open I was managed to work with 5 different users sharing video and audio . this is very awesome. now I can have power full server and mediasoup will do the rest @ibc thanks for amazing cost effective feature. no need for extra worker at least for now.
@zaidiqbalsoftech as I said I don’t have requirement for high-resolution. very low res low frame rate. but large audience
@zaidiqbalsoftech you don’t so many worker. all you have to do is one worker per router then just create room and every room will have common worker and router then just make a Map object for list of users. mediasoup will do the rest. let me know if you need any help.