Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a network of 100 machines, all with ubuntu Linux.

Is there a limit to the number of machines that can connect to one single machine (at the same time)?

For example, can I have 99 of my machines maintain continuous ssh connection to the 100th machine? Can I have every one of my machines (every one of the 100) maintain a continuous ssh connection to all other 99 machines?

How much memory does each such a connection take?

share|improve this question
up vote 4 down vote accepted

The number of total connections is limited mostly by the number of ports they can come in on, and the capability of the system. There are configuration options (Max_Sessions and Max_Startup) but they only apply to the number of connections FROM a single IP, and the number of concurrent requested startup connections...Basically they're DDOS protection.

There is no easy way to tell how much memory a connection is going to use: it is entirely dependent on the amount of traffic. One extremely heavily utilized connection can use more resources than 10,000 connections that are doing nothing.

All that being said, it's almost always going to be a better idea to have the connections established when they're needed, and closed when they're not.

share|improve this answer
Thank you for your answer. My goal is to be able to write/read data to each one of the nodes, as fast as possible. opening & closing the connections would drop my performance. any other ideas how to achieve this? – user74781 Apr 4 '11 at 16:09
@user: If you're going to be writing from 100 connections at the same time, you're going to run into problems very quickly...Very likely you'll saturate your bandwidth before anything else has a chance to break. What kind of data, and does it have to be real-time? – Satanicpuppy Apr 4 '11 at 16:19
thank you. I will likely write data from ONE CONNECTION to the other 99. the data I get is streaming real-time. I am processing it in machine X in-memory, and want to find the fastest way to send (in parallel, if possible) all the 'data pieces' to each one of the other 99 machines (meaning, each machine will get its piece). Then, it is up to each individual machine to process the data it has received and store it in its local disk. does it make sense? – user74781 Apr 4 '11 at 16:26
@user: So you're looking at outbound connections, from one machine to 99 other machines, or are we talking 100 machines all constantly connected to 99 other machines all hammering each other with real-time data? You'll probably have a lot more success having the machines all aggregate the data in local groups, rather than every machine getting a complete copy of the data. – Satanicpuppy Apr 4 '11 at 16:30
yes, suppose we're talking about outbound connections. There's one machine that gets the data. it splits it to pieces. What is the fastest way for it to send the 'pieces' to the individual machines? – user74781 Apr 4 '11 at 16:48

I think you can. I routinely have 3 or so on my home box, and at my office we can have up to 10. It only really depends on what your computer can handle.

There are settings in sshd_config that you may have to change. Here's a link to the man page. It is found in /etc/ssh/sshd_config. Default is 10. You'll need to increase this.

I found this resource that talked about how to increase the maximum. Here's a little explanation:

  • /proc/sys/net/core/somaxconn- maximum TCP connections (SSH connects over TCP)
  • /proc/sys/net/core/netdev_max_backlog- not as big of a deal, this is the max packet queue

You can just edit these numbers if you need to increase it. My default somaxconn is 128, so you should be good.


Other options

Use websockets with NodeJS.

This should get you started. If you don't want to learn how to use websockets, just send HTTP Post requests to a webserver. They don't have too much overhead and you can send a lot of data this way. I would personally opt for the websockets because they're real-time and are not too difficult to set up.

share|improve this answer
Yes, I also have a default somaxconn of 128. My goal here is to be able to write/read data to each one of the nodes, as fast as possible. Do you have any 'better' (faster) suggestions of how do achieve this, rather than connecting through ssh? – user74781 Apr 4 '11 at 16:12
Just read and write data? Use rsync for files, it tracks changes and reduces total network overhead. I assume that by nodes you mean individual computers. What exactly do you want to do? – tjameson Apr 4 '11 at 16:14
You could also set up an HTTP server (for example NodeJS) and make a simple server that handles websockets if you just want to send data. There would be virtually no network overhead and it stays open. The drawback is you have to do some programming. – tjameson Apr 4 '11 at 16:16
@tjameson: rsync is good to send/receive files. My goal here is to be able to write data to individual machines (connected in a network) in the fastest possible way. My source data comes streaming into the memory of machine X. I process it in-memory, and then need to store it. It's a lot of data, hence, I would ideally want to split the data in memory (using some logic) and just send it (meaning, pieces of it) to every individual computer, in the fastest way. that individual computer will handle the writing of data into its local disk. – user74781 Apr 4 '11 at 16:19
Then I would use websockets. Set up websockets using NodeJS or something similar and push data to each of them using whatever logic you need. I'll post a couple links to my answer. – tjameson Apr 4 '11 at 16:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .