Question

What is the overhead associated with keeping a socket open on the server?

Let's say that you've got millions of concurrent connections like facebook, would sockets add too much overhead compared to HTTP requests? I know that sockets will reduce network overhead by a good amount (because of headers), but would sockets be the better choice? If you don't update the client REAL-TIME, but still send batches of information (every few seconds or whenever the client requests) to the client which is the better option to serve these millions of users in terms of scalability, performance and server side overhead? (Would you have to scale more/faster using sockets or http?)

Was it helpful?

Solution

The correct question to ask is "How many sockets can I keep open per server".

It depends on the OS.

Linux:
The value set to net.ipv4.netfilter.ip_conntrack_max

https://serverfault.com/questions/10852/what-limits-the-maximum-number-of-connections-on-a-linux-server


Windows:

70,000 connections on a reasonably low spec VM

Max tcp/ip connections on Windows Server 2008


Then it of course depends on how well written your application is, the hardware spec etc etc.

So I would say that you should not design your application per the amount of open sockets because your application would probably crash and burn before the socket limit is reached.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top