Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maximum number of concurrent connections on a single port (socket) of Server

What could be the maximum number of concurrent Clients (using different port number) that could communicate to a Server on the same port (Single socket) ? What are the factors that could influence this count ? I am looking for this information w.r.t telnet in Linux environment.

like image 277
Karthik Balaguru Avatar asked Feb 28 '10 04:02

Karthik Balaguru


People also ask

How many connections can be in a socket?

For most socket interfaces, the maximum number of sockets allowed per each connection between an application and the TCP/IP sockets interface is 65535. The exceptions to this rule are the C sockets interface and the C sockets interface for CICS®, where the maximum allowed for both of these interfaces is 2000.

What is the maximum number of concurrent connections?

By default, SQL Server allows a maximum of 32767 concurrent connections which is the maximum number of users that can simultaneously log in to the SQL server instance. How to bypass this limit.

How many concurrent users can a server handle?

With a single CPU core, a web server can handle around 250 concurrent requests at one time, so with 2 CPU cores, your server can handle 500 visitors at the same time.

Can a single port have multiple connections?

A single listening port can accept more than one connection simultaneously.


2 Answers

This depends in part on your operating system.

There is however no limit on a specific port. There is a limit on the number of concurrent connections however, typically limited by the number of file descriptors the kernel supports (eg 2048).

The thing to remember is that a TCP connection is unique and a connection is a pair of end points (local and remote IP address and port) so it doesn't matter if 1000 connections connect to the same port on a server because the connections are all still unique because the other end is different.

The other limit to be aware of is that a machine can only make about 64K outbound connections or the kernel limit on connections, whichever is lower. That's because port is an unsigned 16 bit number (0-65535) and each outbound connection uses one of those ports.

You can extend this by giving a machine additional IP addresses. Each IP address is another address space of 64K addresses.

like image 99
cletus Avatar answered Oct 07 '22 18:10

cletus


More than you care about. Or rather.

  • More than your code can actually handle (for other reasons)
  • More than your clients will actually make
  • More than you can handle on a single box for performance reasons
  • More than you need on a single box because your load balancers will distribute them amongst several for availability reasons anyway

I can guarantee that it is more than all of those. There are scalability limitations with large numbers of sockets, which can be worked around (Google for the c10k problem). In practice it is possible to have more than 10,000 sockets usefully used by a single process under Linux. If you have multiple processes per server, you can increase that up again.

It is not necessary to use a single port, as your dedicated load-balancers will be able to round-robin several ports if needed.

If you are running a service for many 10s of 1000s of client processes, it is probably fairly important that it keeps working, therefore you will need several servers for redunancy ANYWAY. Therefore you won't have a problem deploying a few more servers.

like image 22
MarkR Avatar answered Oct 07 '22 18:10

MarkR