Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.