1

I have a computing cluster of 44 cores and 256GB memory running Ubuntu and I'd like to limit the number of CPUs and memory used by certain users. Limiting memory usage would be more important. So for example, I'd like to say that user X should only be able to use 10 CPUs and 50GB memory.

How can I achieve this?

terdon
  • 242,166
  • if not possible via vm level, you might want to look at cpulimit(http://cpulimit.sourceforge.net/) to control your application cpu usage. – Don Pobre Feb 07 '19 at 17:09
  • https://unix.stackexchange.com/questions/34334/how-to-create-a-user-with-limited-ram-usage – Jan Kratochvil Aug 02 '22 at 09:14

1 Answers1

2

From a quick google search you seem to need ulimit. See more on that through man limits.conf.

The best way to limit resources is through VMs (XEN/KVM/OpenVZ), but I don't think it's what you asked for.

dzervas
  • 509
  • Thanks! I added the line username hard nproc 8. However it didn't seem to work and if I type ulimit -Ha I don't see the limits I have set. Do I need to restart? The problem is that users are running jobs and a restart would be inconvenient. – Adam Gosztolai Aug 22 '16 at 14:51
  • Well, theoretically you dont have to restart, you have to log out all your active sessions, but that's too close to a reboot (and rebooting is much easier) – dzervas Aug 22 '16 at 15:28
  • You don't even have to logout. You only need to exit processes that have the old privileges. – ctrl-alt-delor Feb 07 '19 at 17:34