LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 04-20-2010, 06:31 AM   #1
zQUEz
Member
 
Registered: Jun 2007
Distribution: Fedora, RHEL, Centos
Posts: 294

Rep: Reputation: 54
Does RES in top reflect any shared memory?


I am trying to troubleshoot an Apache/Mysql server that once every few days falls over due to memory starvation. I thought I had tuned my httpd.conf file with relativley small MaxClients and so on, but then noticed some unusual RES values in top while monitoring.

In short, `top -b -n1 -u apache` shows that I have 28 httpd processes. their VIRT is ~300MB for each process (I understand this is shared), and the RES ~50MB for each. I thought this wasn't shared. Is this true?
I just noticed 2 of the processes jump to 1.2g. If RES represents non-shared memory then concievably 1.2g x 28 processes would be a problem on an 8GB server.

Can anyone confirm whether RES is shared or not?
thanks
 
Old 04-30-2010, 07:26 AM   #2
stuart_cherrington
Member
 
Registered: Aug 2008
Location: Get back in your Cube Unix Boy!
Distribution: rh5, oel5, debian etch, solaris
Posts: 228

Rep: Reputation: 36
Funny, I was looking at top yesterday trying to work out a few issues with memory allocation on an RHEL 4.7 box. From what I read RES is the amount of physical memory the process is using but does NOT consist of SHR'ed memory. So yeh, if your apache starts chewing 1.2G per process then your box is in trouble.

I believe you can set memory usage per process in Apache, but the syntax wasn't easy to find. Also check your Apache and MySQL log files to see where the memory is going.

Stuart.
 
Old 04-30-2010, 07:40 AM   #3
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
I was hoping someone who was sure of the answer would reply here.

From a bunch of observations in which I think I understand the memory use and then look at the top output, I'm pretty sure the memory reported in SHR is entirely contained in the memory reported in RES.

RES in turn should be entirely contained in VIRT.

Looked at the other way, RES contains all of SHR plus some other things. VIRT contains all of RES plus some other things.

SHR is not just memory that is shared, it is also memory that could be shared. Depending on how much actually is shared, the total RES across all processes could exceed the total ram.

All of the above is from observation, not from reading the source code of top to see what it reads and then reading the source code of the kernel to see what the values top reads mean. That's why I hoped someone who had dug through that source code might answer.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Does /dev/shm reduce memory available for non-shared memory segments? mightyscotchpine Linux - Server 1 09-22-2009 06:58 PM
Linux shared memory segment access problem and x86 Virtual Memory layout. regmee Linux - Kernel 1 08-23-2008 12:11 AM
Difference between resident memory,shared memory and virtual memory in system monitor mathimca05 Linux - Newbie 1 11-11-2007 04:05 AM
is shared memory expandable in memory size? Thinking Programming 4 08-16-2005 09:57 AM
Black strips on top res of video lectraplayer Linux - Laptop and Netbook 0 12-03-2003 09:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:20 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