ulimit in linux
Hi,
I would like to know if we can use ulimit to control the maximum memory usage per process and cpu for each all the normal user on the linux system? The reason behind is i want to control the max usage of memory per user, in order to avoid the system memory and cpu highload, which will causing system hung. Any advice will be appreciated. Thanks |
I thought ulimit controlled the amount of disk space a certain user could use? maybe it does more.....
|
I don't think there is a way to limit cpu usage as a percentage, but you can limit the amount of CPU time a user process is allowed as well as the maximum memory resident size. Instead of controlling these settings with ulimit, this is better configured by configuring /etc/security/limits.conf - especially if you want to control more than 1 user. To answer your question's specifics, here is an example of a limits.conf file trying to accomplish your goals:
Code:
@foo hard cpu 10 |
Thanks a lot for all the feedback. I'm thinking if control the limit, there will be the risk that it will kill the user job which reall need so much memory. Or may be i should ask if there is a way to reserve the memory and cpu resources for system process, instead of controlling at the user level.
|
Generally, the system processes will always have a higher priority than user processes. So when the system is 'hanging' it is the users' processes that are hanging and not the system processes that are hanging. It appears to me that you just have an overloaded system and should look into taking other action, such as:
1) Moving some users to a different server. 2) Upgrading to a server (or servers) with more and faster CPUs as well as more RAM. I think you certainly have enough justification to take either action. |
Thanks for adviced....ya, there is a lot of user session on the system. I already have 4GB memory on the system. And most of the user just running normal Xvnc and ssh session.
Thanks man. |
All times are GMT -5. The time now is 12:04 AM. |