Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am quite new in the Linux / Server environment. I installed Debian Squeeze on vmWare Server to run LAMP. After I had the LAMP configured and running I decided to check on the memory usage of the server, and I found it to be high. I am not familiar with Linux, so I might be wrong to think that it is high. I noticed that Apache and MySQL uses a lot of memory.

I have posted the output of the memory usage. Maybe someone could take a look at it and tell me that the memory usage is fine or that it's not and maybe give me some idea as to why it's that high.

share|improve this question
up vote 2 down vote accepted

What you probably want to know is "How much free RAM can my computer get if it needs them?". The answer is, from your top output:

Mem-Free = 36780k
Mem-Buffers = 5456k
Swap-Cached = = 360700k

That's 364MB of RAM, out of 512MB total available in your system, which is pretty good.

One common source confusion is that "Swap:Cached" in the top output is not actually related to the swap space at all. That's RAM space used for block cache ("hard disk content cache").

See also the "Memory Usage" from this tutorial I wrote for my former employer.

share|improve this answer
So I guess I can reduce the virtual memory to something lower to free up memory for other virtual machines or host OS – moleculezz Mar 22 '11 at 19:55
Disk buffer caching is very important for performance so it's healthy to leave lots of RAM for this purpose. Just keep this in mind. – Yves Junqueira Mar 22 '11 at 21:41
Ok, thanks @Yves – moleculezz Mar 23 '11 at 9:06

That is a high memory usage, and it's a good thing! See

share|improve this answer

This is normal, if you notice the usage is 472308k and of that 360700k is listed as cache. The OS is using this "Free" memory as storage. If a program comes in and requests memory, the system will relinquish some of the cached memory to the requesting program. It just uses the available memory when it can to speed up certain operations.

So just looking at total Free memory within Linux is a bit misleading.

As for the apache usage, this is also normal. To take info directly from the top man page:

 VIRT -- Virtual Image (kb)
  The total amount of virtual memory used by the task. It includes all code, data and             shared libraries plus pages that have been swapped out. 
 (Note: you can define the STATSIZE=1 environment variable and the VIRT will be calculated from the /proc/#/state VmSize field.)

 RES -- Resident size (kb)
  The non-swapped physical memory a task has used.

So VIRT includes all memory usage, which in this case the apache processes are actually going to be having a lot of the code, libraries etc, in common which is why they are around 300mb. The RES is the size of the resident set of data actually being used currently, which on your system is around 16mb for some of the processes.

share|improve this answer

Your Answer


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.