WebRTC connections cause overload on servers

We have developed an application that streams live and playback on multiple cameras while using WebRTC as the main technology of stream. We have noticed that by neither explicitly closing the connection via (peerConnection.close()) nor by connection timeout-ing (for example the browser closing), the connection from the server in not being closed.

This causes the server to grow CPU usage to 100% for a very short time (the client using the application has a lot of cameras).

Please advice us on fixing this issue.

We would like to start by seeing the logs, hopefully we find a clue there.
“C:\ProgramData\Milestone\XProtect API Gateway\Logs\gateway.log”

Hello and thank you so much for answering. Our client is a Government structure and we will have to go physically there this week to provide the logs. Please give us a few days to try and get the logs and we will get back to you.

Thank you in advance.

You are not able to reproduce the issue in your development and test server?

No, because the issue only comes with huge number of devices, and we have only 3 for our test environment.

So the connections are closing in the small test system? And, they are not closing in the large system where it makes a difference that they are not closing, how unfortunate. I guess first step is still logs.