Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.
Mem:   8176880k total,  8059736k used,   117144k free,    93040k buffers
Swap:  1004052k total,      108k used,  1003944k free,  7257056k cached
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND            
 4992 mysql     20   0  291m 115m 5380 S   65  1.4 739:54.71 mysqld             
20260 apache    20   0 43032  18m 3964 S   27  0.2   0:02.50 apache2            
20154 apache    20   0 41588  16m 3964 S   10  0.2   0:00.40 apache2
<snip>

Is this: Mem: 8176880k total, 8059736k used; anything to be worried about!?

And ideas?

many thanks

edit: forgot to say I know nothing about servers, I've been landed with this...

answer:

> free -m
             total       used       free     shared    buffers     cached
Mem:          7985       7665        320          0         89       6942
-/+ buffers/cache:        633       7352
Swap:          980          0        980

doesn't look like I have a memory issue after all

share|improve this question

2 Answers 2

up vote 5 down vote accepted

This is fine - the VIRT value is often around this figure when using prefork.c (which I assume you are):

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
10385 apache    15   0  376m  48m 3932 R 20.3  1.2   0:01.34 httpd
10423 apache    16   0  376m  46m 4576 S 15.0  1.2   0:01.09 httpd
10153 apache    15   0  337m  61m 4672 S 11.6  1.6   0:03.94 httpd
10419 apache    15   0  383m  54m 4696 S 11.6  1.4   0:01.00 httpd

The value you want to monitor is RES - this is the size of the greatest amount of memory that child thread has consumed (in my case, PHP is run as part of that thread, hence the "bloat" as libraries and data are loaded). The thread will not release the allocated memory, however when the apache process kills the thread after its maxrequests as per

<IfModule prefork.c>
MaxRequestsPerChild  1000

the thread will return to its native memory consumption.

To lower these values, ensure you are only loading the apache modules you require, and monitor apache's threads while you run a very large PHP script (ini_set('memory_limit', '128M');then recursively load data into an array - that should do it). Then, during real world usage, lower the MaxRequestsPerChild value until you see your apache RES at a reasonable level.

Here are some useful parameter tuning articles:

share|improve this answer
    
Well the RES seems OK, what worries me is the Mem: 8176880k total, 8059736k used, stated at the top. You mentioned apache not releasing the mem reserved? How do I find out!? Thanks –  Dorjan Sep 24 '09 at 15:06
    
After looking on your articles I can see it isn't a memory issue (i think) –  Dorjan Sep 24 '09 at 15:26
    
As HD says, top doesn't report memory usage in the traditional sense, there is a very well written response to that particular query linuxforums.org/forum/linux-newbie/… –  Andy Sep 24 '09 at 16:20

It's ok. Free memory means RAM that is not used by systems, applications and cache. You can consider "Buffers" and "Cached" as another free RAM. So you have around 7 GB of free ram. With the command:

free

you can see the "real" free RAM in the line: -/+ buffers/cache. Also you can use htop.

share|improve this answer
    
Thanks HD, I've already figured it all out as you can see in my edit :) –  Dorjan Sep 24 '09 at 17:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.