LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-23-2004, 03:13 AM   #1
Fredy71
LQ Newbie
 
Registered: Mar 2004
Location: Münchwilen (TG), Switzerland
Posts: 13

Rep: Reputation: 0
How to monitor low memory?


Hi,
recently I had a crash on one of my servers (Compaq ProLiant), which are running on Red Hat 8.0. According to the messages file, the reason was a low memory issue, but I couldn't find out which process it was, which needed so much memory.
Thus it raised the question, how I could monitor the memory and also the virtual memory. My idea is, that if the memory on the server exceeds a certain value, a script or something similar should capture the 5 processes (with name and pid) which are using the most memory and its memory usage.

Does anybody know whether there is already a solution out there? Or which solution for the problem would you suggest?

Thanks and kind regards

Fredy
 
Old 12-23-2004, 03:32 AM   #2
mijenks
Member
 
Registered: Mar 2004
Location: NY
Distribution: Gentoo
Posts: 112

Rep: Reputation: 15
run 'top'
 
Old 12-23-2004, 03:42 AM   #3
oneandoneis2
Senior Member
 
Registered: Nov 2003
Location: London, England
Distribution: Ubuntu
Posts: 1,460

Rep: Reputation: 48
Or just ps aux
 
Old 12-23-2004, 03:46 AM   #4
Fredy71
LQ Newbie
 
Registered: Mar 2004
Location: Münchwilen (TG), Switzerland
Posts: 13

Original Poster
Rep: Reputation: 0
This wouldn't work, because 'top' monitors processes by the top cpu usage. But I need the processes monitored by the top most memory usage.
Any other suggestions?

Fredy
 
Old 12-23-2004, 03:50 AM   #5
redjokerx
Member
 
Registered: Aug 2004
Location: San Diego
Distribution: Slackware
Posts: 303

Rep: Reputation: 31
I think top can sort by memory.
 
Old 12-23-2004, 04:16 AM   #6
Fredy71
LQ Newbie
 
Registered: Mar 2004
Location: Münchwilen (TG), Switzerland
Posts: 13

Original Poster
Rep: Reputation: 0
How can this be done in a non interactive way?
 
Old 12-23-2004, 06:18 AM   #7
EyesOnly
Member
 
Registered: Aug 2003
Location: The Netherlands
Distribution: SlackWare
Posts: 202

Rep: Reputation: 30
you can use 'free', which will show memory information, both RAM and swap.
You could make some kind of script, which could take actions when free memory is below some value.

But isn't something alike this already build into the kernel?
Atleast on my desktop system, I used to have a program that on a specific action suddenly used HUGE amounts of memory. My computer than became very slow for a few seconds, and after that this program was killed, and memory-usage back to normal.
When looking at dmesg, the program was killed by the kernel, because of low memory.

Sounds like what you need. This was on a 2.6 kernel, by the way...
 
Old 12-23-2004, 08:30 AM   #8
Fredy71
LQ Newbie
 
Registered: Mar 2004
Location: Münchwilen (TG), Switzerland
Posts: 13

Original Poster
Rep: Reputation: 0
According to the messages entry, there were some processes killed, thats true.
But first I don't know which processes were killed - only the pid were given and I should also know which program.
Second I doupt that the kernel know which process is the correct one to kill. I rather think that the kernel chooses an arbitrary process to kill.
Third the server did crash anyway. This indicates that the kernel choosed the wrong process to kill.

With the command 'free' I only know the entire memory usage, but not which process is using which amount of memory.
I think this problem should have been solved already. The question is just how and where to get a solution..
 
Old 12-23-2004, 09:39 AM   #9
EyesOnly
Member
 
Registered: Aug 2003
Location: The Netherlands
Distribution: SlackWare
Posts: 202

Rep: Reputation: 30
Quote:
Originally posted by Fredy71
According to the messages entry, there were some processes killed, thats true.
But first I don't know which processes were killed - only the pid were given and I should also know which program.
On my system I did have both the pid and the process-name in dmesg, but you might be running a 2.4 kernel instead of 2.6, which could explain this..
Quote:
Second I doupt that the kernel know which process is the correct one to kill. I rather think that the kernel chooses an arbitrary process to kill.
I did some googling around, since i got intrested by this.. It appears to be a more complex subject than can be figured out in a short brake at work
But anyways, there seems to be a lot of work in this.. I am quite sure that the kernel does a better job at this than any script you write (no offense.. )

btw. In the case i wrote about in my last post, the kernel did pick the right process..
Quote:
Third the server did crash anyway. This indicates that the kernel choosed the wrong process to kill.
What kernel version are you running exactly? from what i've read from my little bit of googling,early 2.4 kernels did indeed pick the wrong process sometimes..
Quote:
With the command 'free' I only know the entire memory usage, but not which process is using which amount of memory.
I think this problem should have been solved already. The question is just how and where to get a solution.
Really, do some googling. Lots of work have been done on it, and i found out it is a lot more complex than i thought at first..
It might suprise you, too
 
Old 12-23-2004, 10:05 AM   #10
Fredy71
LQ Newbie
 
Registered: Mar 2004
Location: Münchwilen (TG), Switzerland
Posts: 13

Original Poster
Rep: Reputation: 0
Actually, the kernel I use on this server is a 2.4.x. I will googling now (as I did already) a bit more and come back if I have a solution.

Thanks for your contribution
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
memory low ?? time112852 Linux - Software 8 09-28-2005 09:12 PM
low memory requirements super_teds Linux - Distributions 4 06-20-2005 11:49 PM
Low memory laptop -Dice Linux - Newbie 4 05-11-2004 05:36 PM
Low memory configuration?? Mercutio701 Linux - Newbie 4 02-07-2004 12:16 PM
RedHat 7.1, Low Memory BigBrother Linux - Software 7 07-11-2001 10:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:59 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration