Hi all,
I just had an interesting conversation with a friend. I think the
problem we are talking about is quite open ended. So I would like to
share it and see what others say about it.
Let's first take a look at the problem: My friend is working on a
service which needs to handle lots of concurrent TCP connections. As you
can imagine, I suggest him to use Go.
He then told me that his company would like to handle ~100K connections
per server. His colleague made a quick benchmark in Go the other day and
the Go program handles 5K connections by utilizing 200% of the CPU.
5K connections is apparently not the maximum that a Go program can get.
(As far as I know, vitess claims it can handle 10K connections.)
Moreover, such benchmark relies on the underlying hardware, OS
configuration, etc. (I'm unable to get details about the benchmark or
the configuration information.)
Although it's not a new problem to this field, his problem made me
google some existing solutions/suggestions about handling large amount
of concurrent TCP connections. For something like node.js, we need some
tweaks[1]. Eventually, "The kernel isn’t the solution. The kernel is the
problem."
Specific to Go, I didn't find anything related to handling large amount
of concurrent TCP connections. But I believe there must be someone who
has the experience of working on such scale. It would be great if you
can share here. Any suggestion/discussion is welcome. As I mentioned,
this is an open ended problem. I won't mind if you throw me some crazy idea.
[1]
http://blog.caustik.com/2012/04/08/scaling-node-js-to-100k-concurrent-connections/
[2]
http://highscalability.com/blog/2013/5/13/the-secret-to-10-million-concurrent-connections-the-kernel-i.html