After reading the famous C10k article and searching on the web about how things have evolved since it was written, I would like to know if it would be possible for a today's standard server to handle >10000 concurrent connections using a thread per connection (possibly with the help of a pool of threads to avoid the creation/killing process).
Some details that may affect the approach to the problem:
Obviously I'm not an expert in the matter, so any remarks or advices will be highly appreciated :)
Absolutely. A standard server can handle more than 10K concurrent connections using the model with one thread per connection. I have build such an application, and five years ago, it was running with more than 50K concurrent connections per process on a standard Linux server. Nowadays, it should be possible to run the same application with more than 250K concurrent connections on current hardware.
There are only a few things to keep in mind:
SO_REUSEPORT
.open files
(default 1.024), max user processes
/proc/sys/kernel/pid_max
(default 32K), /proc/sys/kernel/threads-max
, and /proc/sys/vm/max_map_count
(default 65K).The application mentioned above was initially designed to handle only 2K concurrent connections. However, with the growth in use, we didn't have to make significant changes to the code in order to scale up to 50K connections.
You might like a recent follow-up on the subject: The Secret To 10 Million Concurrent Connections -The Kernel Is The Problem, Not The Solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With