Is it possible to change the soft – and hard limit of a specific process?
In my case, my process is mongod
and a lot of web resources tell me to simply execute:
ulimit -n <my new value>
My current thoughts:
- How will the command know the limit of the process that I'll be modifying? Won't this modify the whole systems open file limit?
- I'm guessing that this command only changes the soft limit. So is there a way to increase the hard limit too?
Best Answer
To change the limits of a running process, you may use the utility command
prlimit
.What that does internally is to call
setrlimit(2)
. The man page of prlimit should contain some useful invocation examples.Source: https://sig-io.nl/posts/run-time-editing-of-limits-in-linux/