How to retain one million simultaneous TCP connections?

前端 未结 6 591
心在旅途
心在旅途 2021-01-30 01:09

I am to design a server that needs to serve millions of clients that are simultaneously connected with the server via TCP.

The data traffic between the server a

6条回答
  •  难免孤独
    2021-01-30 01:52

    As Greg mentioned, the problem you are describing is C10K (or rather "C1M" in your case ) I recently made a simple TCP echo server on linux that scales very well with the number of sessions (only tested up to 200.000 though), by using the epoll queue. On BSD, you have something similar called kqueue. You can check out the code if you want to. Hope this helps and good luck!

提交回复
热议问题