1

Is there a limitation by hardware or software for Pi to be used by a number of different users?

For example when I ssh into Pi from my computer with my user, I can keep working on Pi also in root user without interacting with other by monitor and keyboard. I think by some other modifications port 23(telnet) and also other ports can be used to connect and work on Pi.

Partial solution after testing

According to Joan's answer I've ran a test and by checking htop|top output figured out each ssh instance was occupying ~3KiB of memory by daemon sshd. So it can be concluded as there isn't a software limit but a hardware limit regarding memory. Also if other equivalents to sshd are used it might take more or less memory so one can have more or less simultaneous connections, a different user took ~4KiB memory via sshd so again most probably there is only hardware limitation.

  • 1
    Keep in mind that sshd on provides a connection. Anything you do while using that connection will create another process that will also use memory. – TomG Aug 7 '15 at 17:10
  • 1
    Yea it all depends what you want to do. I can have a thousand requests per second served by Node.JS over the LAN or just 1 video transcode. Define the scope, then find the limits. For example you can have 1000 users log on to the website via Node.JS while the Pi does one thing for all them... but it all depends what you would like to do. – Piotr Kula Aug 7 '15 at 17:22
  • You are right @TomG , but I'm not sure if it gives an error or wait for enough empty in memory at that time, do you have an idea? – Tolga Varol Aug 7 '15 at 17:36
  • 1
    First, the system will get slow as it starts to reallocate memory from io buffers to process space, but eventually programs will get errors when they try to allocate memory. How those programs report the problem will vary; in many cases, they'll just crash. If you have a swap file, you can trade performance for memory, but a swapfile isn't really practical on a SD card due to the slow performance. – TomG Aug 7 '15 at 18:05
  • 1
    WRT mem use of sshd: When there are multiple instances, look at the SHR number next to the RSS. That amount is being shared between processes; there will always be some because of the way libraries work, but there stands to be a lot more when there are multiple instances of the same thing -- I think in the case of sshd each new instance really only adds about 1/2 kB, because SHR is 90% of the 5 kB RSS. Same logic applies to the shell. – goldilocks Aug 7 '15 at 19:47
2

No, the system does not impose a limit (not quite true but the limits are well beyond what you would sensibly do in practice).

In practice the number of users logged in will be limited by how many you can find a reason to simultaenously use.

If I was carrying out a test I might log in as the same user a dozen times, with each window showing a different view of the test, e.g. one might be generating output, a couple might be listening for inputs, a couple might display error message, one might be running top to monitor CPU usage, etc. etc.

  • I have tried with 14 windows in same user and there wasn't a problem I ran some commands no error occured, but wouldn't it be different with different users – Tolga Varol Aug 7 '15 at 16:54
  • 1
    @TolgaVarol The user id should make no difference. – joan Aug 7 '15 at 17:47
1

This is a tangential answer to your question based on your observation that the limit, at least on the pi, is probably memory.

If you want to determine how much memory is used by a particular user, one way to do this is via the -u switch to top, e.g.,

top -u pi

Will show all the processes belonging to user pi. The total of the RES amounts would be what is used for that user (who may be logged in multiple times). However, note that the SHR value is very significant here. Its exact significance is hard to calculate,1 but if it is quite high, it likely means there is another process created from the same binary. For example, there may be many instances of bash running simultaneously, and their SHR number may be 90% of their RES number, indicating each one really only added 10% of the RES amount to the amount of RAM actually consumed.

For an ssh login, there are minimally two processes, an sshd fork (although I think this depends on your sshd.config) and a shell instance.

Finally, note that a maximum number of logins can set for the system as a whole or per-user; see man limits.conf and /etc/security/limits.conf.


1. And impossible based on the information top provides; some tools will report a "proportional set size" (PSS) which is a calculation based on how many other processes are sharing a particular memory segment; if there are 6, the PSS number will only include 1/6th of the segment size for each process. Note there are many such segments, but the kernel tracks this and you can find the number in /proc/[pid]/smaps.

  • I just checked the way you proposed and sshd is taking a fixed amount of 3600 under RES, when I execute something such is ifconfig it increases and again comes back to stable 3600, a watched for a while and didn't change at all. And I also think there might be a bug since as I exited ssh and re-run top -u pi I see there the processes still exist. By the way thanks a lot for SHR and limiting explanations. – Tolga Varol Aug 9 '15 at 18:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.