How Many Network Connections Can a Computer Support?

10,721

Solution 1

Dan Kegel put together a summary of techniques for handling large amounts of network connections from a single server, here: http://www.kegel.com/c10k.html

Solution 2

In general modern servers can handle very large numbers of concurrent connections. I've worked on systems having over 8,000 concurrently open TCP/IP sockets.

You will need a high quality servicing interface to handle that kind of load, check out libevent or libev.

Solution 3

That is a good question and it definitely is situational. What is your computer? Do you have a 4 socket machine filled with Quad Core Xeons, 128 GB of RAM, and Fiber Channel Connectivity (like the pair of Dell R900s we just bought)? Or are you running on a p3 550 with 256 MB of RAM, and 56K modem? How much load does each connection place on your server? What kind of response is acceptible?

These are the questions you need to answer. I guess the best way to find the answer is through load testing. Create a unit test of the expected (and maybe some unexpected) paths that your code will perform against your server. Find a load testing framework that will allow you to simulate 10, 100, 1000, 10000 users performing those tasks at the same time.

That will tell you how many connections your computer can support.

The great thing about the load/unit test scenario is that you can put in response time expectations in your unit tests and increase the load until you fall outside of your response time. If you have a requirement of supporting X number of Users with Y second response, you will be able to demonstrate it with your load tests.

Share:
10,721
Jon Ball
Author by

Jon Ball

Updated on June 20, 2022

Comments

  • Jon Ball
    Jon Ball about 2 years

    When writing a custom server, what are the best practices or techniques to determine maximum number of users that can connect to the server at any given time?

    I would assume that the capabilities of the computer hardware, network capacity, and server protocol would all be important factors.

    Also, do you think it is a good practice to limit the number of network connections to a certain maximum number of users? Or should the server not limit the number of network connections and let performance degrade until the response time is extremely high?

  • Alexis Wilke
    Alexis Wilke about 9 years
    That paper looks really old (1999) and not really up to date. For example, the ulimit under Linux (at least Ubuntu) is set to unlimited... so setting it to 32768 is probably not necessary?