LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 08-10-2006, 07:12 AM   #1
ahpin
Member
 
Registered: Oct 2003
Location: Malaysia
Distribution: Redhat, Mandrake 9.1, SuSE Linux
Posts: 32

Rep: Reputation: 15
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
 
Old 08-10-2006, 07:49 AM   #2
Samoth
Member
 
Registered: Apr 2005
Distribution: Exherbo
Posts: 474
Blog Entries: 1

Rep: Reputation: 32
I thought ulimit controlled the amount of disk space a certain user could use? maybe it does more.....
 
Old 08-10-2006, 02:28 PM   #3
kordump
LQ Newbie
 
Registered: Jan 2006
Location: Houston, Texas U.S.A.
Distribution: CentOS, RedHat, Fedora, Debian, Ubuntu
Posts: 5

Rep: Reputation: 0
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
@foo            hard    rss             10240
This would limit each user (who is a member of the group 'foo') process to 10 minutes of CPU time - at which point the process would be killed. It should also limit the amount of memory a process can use to 10MB. You'll want to read the documentation that resides in the limits.conf file and make adjustments accordingly. I hope this points you in the right direction.
 
Old 08-10-2006, 09:28 PM   #4
ahpin
Member
 
Registered: Oct 2003
Location: Malaysia
Distribution: Redhat, Mandrake 9.1, SuSE Linux
Posts: 32

Original Poster
Rep: Reputation: 15
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.
 
Old 08-11-2006, 01:52 PM   #5
kordump
LQ Newbie
 
Registered: Jan 2006
Location: Houston, Texas U.S.A.
Distribution: CentOS, RedHat, Fedora, Debian, Ubuntu
Posts: 5

Rep: Reputation: 0
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.
 
Old 08-11-2006, 10:04 PM   #6
ahpin
Member
 
Registered: Oct 2003
Location: Malaysia
Distribution: Redhat, Mandrake 9.1, SuSE Linux
Posts: 32

Original Poster
Rep: Reputation: 15
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.
 
  


Reply

Tags
configuration, performance, tuning


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ulimit introuble Linux - Security 1 07-22-2006 04:33 AM
ulimit -t juanbobo Linux - Security 3 06-10-2005 10:43 AM
ulimit -n evilrico Linux - Distributions 0 03-14-2003 05:23 PM
ulimit Serena Linux - Software 3 08-04-2002 01:22 AM


All times are GMT -5. The time now is 03:10 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration