Which socket-based model should be used for many simultaneous connections?

I need to know which socket-based model is best for servers with many simultaneous connections, just like on an MMORPG server.

I read about c10k, but what should I use if, for example, my server allows only 5,000 clients at a time? Blocking sockets, streaming (one thread per client)? Non-locking connectors, without thread? loop processing all clients in only a few threads? IOCP?

What are the advantages and disadvantages in short? I am already googled, but I have not found a specific cons article about all of these models.

Or is there an easier way to deal with the c10k problem?

Platform: Windows XP

+3
source share
4 answers

Personally, I suggest you use an IOCP-based design, but then I would say that since I have an IOCP-based infrastructure , I have used high-performance servers for clients for many years.

I recently put together some of my reasons for preferring IOCP to other models available in windows, and they are available here on my blog here .

"" , IOCP, , , -, " ", . ++ , , IOCP . .

, ( ) , . WASP dll , ... .

, , IMHO, , DAY 0. , , , , . concurrency . . .

ENet... , ENet IOCP Enet. , ENet , , . ENet , , IOCP. ENet , - IOCP, . , ENet , , , 2011 ENet, .

+4

, , , , , .

, , , .

pacman, , , , .

, , TPC UDP. (http://www.skullbox.net/tcpudp.php)

5000 , , , , , , .

select() (http://www.lowtek.com/sockets/select.html), , , , , .

, , , , , .

+1

?

eNet . , Select() , , , . , .

0

IOCP -- ( -) ReadFile WriteFile.

-, , , , -, .

( , C) , , .

I / O ports cost almost nothing, and this also applies to multiple threads. Therefore, if you can quickly execute your bits, there really is no limit to the number of I / O operations that the NT engine can handle. Your internet connection is likely to be saturated.

0
source

Source: https://habr.com/ru/post/1774202/


All Articles