Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How many stable(infinitely long time) clients connections(sockets) can handle server (boost::asio) on win32 system?

Which model is the most suitable servers model for Windows XP?

if the requirements are: 1. c++ ; 2. using async boost:asio ( BOOST_ASIO_HAS_IOCP is set ); 3. client indefinitely long time communicates with the server.

How many socket server based on the boost:asio can normally stable process?

like image 475
g3plc Avatar asked Dec 11 '25 05:12

g3plc


2 Answers

There really is no single answer that applies to every type of Windows set-up. You indicated in a comment that you had 64 concurrent connections serviced by a single thread. That is fine. In fact, a single thread can service much more than 64 connections - depending on how much work the average message performs. Many designs involve copying the message to a queue and then having background worker threads process the messages in that queue. That way the thread with the message handler remains quite responsive.

How many connections can be serviced by a single thread? That is something that you need to experiment with. It could be 5,000, 50,000 or even 500,000+. Same thing for the thread pool that services the queue of messages waiting to be processed. You need to try different numbers of threads. The result could be quite different depending on how much cpu time, file or DB I/O is done, and how modern your hardware is. Also, keep in mind that there is some significant overhead with threads. For example, a SO poster some time ago said that a design with 1,000,000 threads was dead on arrival. That is still probably true today. So, it is your job to find the number of threads that can most efficiently serve the most connections.

What is the total number of connections that can be achieved with the most modern hardware and a well designed server? Based on what I have read - 1,000,000+. If you were doing it with WCF in C#, plan on less than half that.

like image 95
Bob Bryan Avatar answered Dec 13 '25 03:12

Bob Bryan


There is no limit for connections inside boost::asio. But, there is external limits which can hit you(in order of importance):

  • Your app speed and memory usage.

  • Thread model and generally your app design.

  • Type of connections(SSL or no-SSL). You can run out of memory before sockets. On unix i except normal limit 100k for SSL and 1M for non-SSL.

  • Windows maximum socket limit.

like image 24
PSIAlt Avatar answered Dec 13 '25 04:12

PSIAlt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!