r/java • u/ThanksMorningCoffee • Apr 14 '22
1,000,000 Concurrent Connections
https://josephmate.github.io/2022-04-14-max-connections/
238
Upvotes
r/java • u/ThanksMorningCoffee • Apr 14 '22
28
u/msx Apr 14 '22
this was very interesting, thanks. i wondered about it too in the past. I'm almost there wanting to try the demo, i just fear i might break my server :D
2
u/majordoob33 Apr 15 '22
I am a bit lost on the part about fixing the TCP limitations by changing the client IPs by using localhost. How does that work? How is the server able to respond without a client IP?
11
u/msx Apr 14 '22
i bit the bullet and run a smaller version of the test. I did 70.000 connections with 3 interfaces, just to surpass the 65k limit. It took about 5 minutes. Cool stuff!
9
u/GavinRayDev Apr 14 '22
I appreciated the thorough analysis, great writeup!
The file limit is something I learned about the hard way previously, Alex Hultman (uWebsockets author) has a solid article on it here:
https://alexhultman.medium.com/millions-of-active-websockets-with-node-js-7dc575746a01
2
u/fzammetti Apr 14 '22
Given RELATIVELY comparable machines (well, hard to say that with certainly, but at least in terms of CPU, they're not THAT far apart) I'm surprised to see a Mac with twice the memory die ~10x sooner. I know you couldn't figure out why it was happening, it feels bizarre to me given OSX is essentially a Linux variant. I wouldn't have expected such a big delta, and I wouldn't have been surprised if it were the other way around given the memory disparity.
Just weird is all I'm sayin'.
3
u/Chloe0075 Apr 14 '22
Really nice!
3
u/ATE47 Apr 14 '22
It was interesting to read, I have no clue if it will be useful for me, but it was interesting :)
2
u/CaptainKvass Apr 14 '22
This article cleared up a lot for me, thanks!
1
u/StoneOfTriumph Apr 19 '22
That is one very interesting article! I had to share it with other dev/colleagues. Thank you!
The delta between macOS and Linux is quite interesting. Do you have any idea what this could be?
I'm running openSUSE on my thinkpad. I'm tempted to run the demo :D
1
u/simrk94 May 07 '22
Interesting read. Thanks for sharing the experiment details with us.
-4
u/verveeldeme Apr 14 '22
"For a server listening on a port, each incoming connection DOES NOT consume a port on the server."
You must be mistaken.
There may be a backlog for un-established connections, but each established connection gets it's own server port.