Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the maximum client concurrent connections that web socket server can accept? #1130

Open
Kojesnik opened this issue Mar 14, 2021 · 9 comments

Comments

@Kojesnik
Copy link

Hi, Me and my team trying to use your lib as a ws server. And we faced a 3727 connections limit and nothing helps.
In another issue, u mentioned that it can be thread limit, but no, I have been tested it, and server can handle a big amount of threads. What can be the problem? What could it be?

@marci4
Copy link
Collaborator

marci4 commented Mar 14, 2021

Hello @Kojesnik,

please provide your example application.

Best regards,
Marcel

@Kojesnik
Copy link
Author

Kojesnik commented Mar 15, 2021

@marci4

I found the problem. I tried to create a separate application and test it on our server to see is it a problem with threads size / memory.
And YES! The connection limit increased from 3727 to 4078. In this issue #340 you mentioned that it can be problem with how much Threads can spawn server.
I checked all JVM and SYSTEM params, but nothing helps.

Снимок экрана 2021-03-15 в 12 34 20

Снимок экрана 2021-03-15 в 12 35 14

Снимок экрана 2021-03-15 в 12 35 48

Снимок экрана 2021-03-15 в 12 37 59

By default number of WebSocketWorkers = Runtime.getRuntime().availableProcessors(). For me it is 12.
I tried to set decodersCount = 16 and all is fine, without problems 16 WebSocketWorkers were created but 4078 conn limit still presented. So I guess it is not problem with threads

Снимок экрана 2021-03-15 в 14 25 47

Снимок экрана 2021-03-15 в 14 29 25

Any ideas on what can be the problem?

Best regards,
Mike

@Kojesnik
Copy link
Author

@marci4

Figured out, that for some reason your lib creating so much open files.
netstat shows 4k websocket established connections, while lsof shows over 70k.
My test server simple as it can be, so I dont know why this heppens.
When I switched to netty, and wrote ws server on it, there is no such problem and everything works great

@NoahAndrews
Copy link
Contributor

That's an interesting observation

@bhaswanth88
Copy link

Even I am facing similar situation. Any workaround/tweaks to accept higher number of connections?

@DevasiaThomas
Copy link

@marci4

Figured out, that for some reason your lib creating so much open files. netstat shows 4k websocket established connections, while lsof shows over 70k. My test server simple as it can be, so I dont know why this heppens.

Are those socket files? Maybe thats why sockets are getting extinguished and its capping at the max you mentioned

When I switched to netty, and wrote ws server on it, there is no such problem and everything works great

What framework did you switch to? Or did you just implement it yourself?

@Kojesnik
Copy link
Author

@DevasiaThomas as I remember, I used netty

@DevasiaThomas
Copy link

@Kojesnik @bhaswanth88 This blogpost and its associated whitepaper is what got me here. It's benchmark shows that this library can go to 10k connections. The benchmarks stops there. Maybe you can try run the benchmark in your env to find the culprit?

@DevasiaThomas
Copy link

DevasiaThomas commented May 12, 2022

I tried running the benchmark myself upto 20k connections(200 rounds, 100 per round).. Apparently increments of 100 connections is fine, but when i tried ramping up by 1000 connections per round - it didn't progress beyond the second round 😅 .. @marci4 Maybe there is some clue in the above behavior?

Another thing that was observed was that the benchmark after 200 rounds didn't have success closing the connections. I ended up killing the client process. but the socket files (lsof) persisted in the server for 2 hours and maybe more(my machine auto restarted due to updates)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants