[Novalug] Interesting memory usage on big server
kyle_powell at yahoo.com
Wed Sep 5 16:03:17 EDT 2007
--- Ben Creitz <creitz at gmail.com> wrote:
> The other day I noticed that out of the 32 GB of RAM on the physical
> host, only about 15 GB were "free." It happened to be a good time for
> me to apply some Dell and RH updates and reboot... after the reboot I
> watched with vmstat or 'free' as the available memory slowly trickled
> away... for example this morning 'free' reported 28.9 GB available,
> this afternoon only 27.34 GB. top's results, sorted by memory, do not
> show any processes using much... certainly not on the order of several
> GBs. So I opened a ticket with RH.
Look closely at the output of the "free" command:
[root at foo ~]# free
total used free shared buffers cached
Mem: 384156 378960 5196 0 5868 294996
-/+ buffers/cache: 78096 306060
Swap: 522104 0 522104
While the output shows I have ~5MB free out of the 384MB of RAM in this system,
it also shows I have 5MB allocated to buffers and 294MB in pagecache. Cache
memory can be freed quite easily should the system come under memory pressure.
If you look at the second line, which gives a better picture of the memory
situation by showing used and free memory +/- buffers and cache, you'll see
that only 78MB of memory is in use and 300MB+ is actually available should the
kernel or another program suddenly need more memory. If I looked through the
memory used by processes listed in top, I would probably come up with a number
slightly larger than 78MB (due to the way top displays shared memory usage).
The philosophy behind this is "if you have memory in the system, it should be
used", even if it's just to cache data read from disk. In the event that same
data is needed again, it's much faster to fetch it from memory than to retrieve
it from the disk again. It's fast and easy enough to free it should something
else need the memory in the future. HTH.
Need a vacation? Get great deals
to amazing places on Yahoo! Travel.
More information about the Novalug