NX Witness server - too many TCP connections open when using the API
AnsweredWe're using the API to control our hive. We're getting a warning message from the OnUniversalTcpListener that the number of open TCP connections has reached 2001 of 2000. Using site administration from the client software it si fairly clear that its the user that we have created for the API that is creating the vast majority of these connections.
What are the recommendations around closing API TCP connections properly?
-
Hi Garry,
By default, the Nx Server has a limit of 2000 concurrent TCP connections.
This limit works as built-in DDoS protection and as a resource guard, so that the Nx Server is not overwhelmed by incoming connections.To resolve the issue you encountered, please consider the following options.
- Reuse the HTTP session.
Use one keep-alive session with a small connection pool, and do not create a new client for each call. - Close connections you no longer need.
Close each WebSocket (JSON-RPC, WebRTC signaling) and each media stream when the job is done. - Reuse the session token.
Get one session token and reuse it until the tasks are finished, then delete it.
Do not authenticate for every call. - Raise the limit.
Given the purpose of this limit, we do not recommend raising it unless it is necessary, for example, if the number of clients that will connect and pull streams from the server is expected to exceed the limit.
Please do not hesitate to let us know if you have any concerns or further questions.
Thank you.
0 - Reuse the HTTP session.
Please sign in to leave a comment.
Comments
1 comment