Re: Memory problems
On Wed, Jun 02, 2010 at 05:06:30PM +0200, Jonatan Soto wrote:
> Hi list,
>
> I'm facing a problem with lenny regarding to memory usage.
>
> I have 4 VM lenny based on top of a VMWare ESXi. The system is running for a
> few days and top command shows a very high amount of memory consumption for
> each server. I have a little knowledge of how linux (kernel 2.6) manages
> memory. A nice resource I found is this:
> http://www.linuxhowtos.org/System/Linux%20Memory%20Management.htm
>
> So, I understand that cached memory may be free if some application requires
> it but I don't understand why lenny is consuming 2GB of physical memory.
> It's worth to mention that all the systems are running with only the
> standard package installed and few additional daemons for each server.
>
> I post what top command shows in order to provide better clues of what's
> going on:
>
> Server1:
> top - 18:47:12 up 12 days, 3:57, 2 users, load average: 0.00, 0.00, 0.00
> Tasks: 53 total, 2 running, 51 sleeping, 0 stopped, 0 zombie
> Mem: 3097764k total, 2901684k used, 196080k free, 156460k buffers
> Swap: 578300k total, 0k used, 578300k free, 592736k cached
> additional daemons -> apache2, bind9, sshd
>
> Server2:
> top - 18:48:30 up 12 days, 2:29, 2 users, load average: 0.00, 0.00, 0.00
> Tasks: 55 total, 1 running, 54 sleeping, 0 stopped, 0 zombie
> Mem: 3097764k total, 2412008k used, 685756k free, 145204k buffers
> Swap: 915664k total, 0k used, 915664k free, 155112k cached
> additional daemons -> apache2, sshd
>
> Server3:
> top - 18:52:10 up 12 days, 2:32, 2 users, load average: 0.00, 0.00, 0.00
> Tasks: 72 total, 1 running, 71 sleeping, 0 stopped, 0 zombie
> Mem: 3097764k total, 2263200k used, 834564k free, 49152k buffers
> Swap: 2928632k total, 0k used, 2928632k free, 107700k cached
> additional daemons -> lvm, sshd
>
> Server4:
> top - 16:50:19 up 1 day, 6:42, 2 users, load average: 0.00, 0.00, 0.00
> Tasks: 58 total, 1 running, 57 sleeping, 0 stopped, 0 zombie
> Mem: 3097764k total, 272300k used, 2825464k free, 126164k buffers
> Swap: 1341388k total, 0k used, 1341388k free, 53196k cached
> additional daemons -> bind9, sldap, samba, sshd
>
> --------------------
>
> Note that I've recently rebooted Server4 and it has lower memory consumption
> rather than the others and it is running more daemons.
> May be this issue is a misconfiguration of my servers or a memory leak?
> Should I tweak something in order to improve memory management?
>
> Any help would be much appreciated.
>
> PD: Apache2 is installed using default configuration of the Apache2 official
> Debian release.
Well I would run top, hit 'M' to sort by memory usage, and see which
processes are using the ram.
For example:
top - 11:22:12 up 12 days, 23:25, 11 users, load average: 1.52, 1.51, 1.67
Tasks: 257 total, 1 running, 256 sleeping, 0 stopped, 0 zombie
Cpu(s): 3.5%us, 0.3%sy, 0.0%ni, 86.4%id, 9.8%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 16473836k total, 16311892k used, 161944k free, 5624832k buffers
Swap: 16777208k total, 168k used, 16777040k free, 6619416k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
8998 bacula 20 0 193m 123m 1792 S 28 0.8 1611:17 bacula-dir
21000 snmp 20 0 41976 34m 980 S 0 0.2 2:30.73 snmpd
20123 bind 20 0 117m 27m 860 S 0 0.2 0:00.22 named
20768 mysql 20 0 124m 12m 1060 S 0 0.1 1:26.30 mysqld
23350 root 20 0 34336 9988 7404 S 0 0.1 0:00.76 bat
21302 root 20 0 23564 6772 2312 S 0 0.0 0:02.66 apache2
8829 root 20 0 44808 5892 1276 S 0 0.0 69:42.16 bacula-fd
9077 www-data 20 0 23564 5728 1160 S 0 0.0 0:00.39 apache2
20085 www-data 20 0 23700 5684 1072 S 0 0.0 0:01.12 apache2
22824 www-data 20 0 23564 5684 1120 S 0 0.0 0:00.46 apache2
1128 www-data 20 0 23564 5676 1160 S 0 0.0 0:00.34 apache2
22821 www-data 20 0 23564 5676 1112 S 0 0.0 0:00.40 apache2
9079 www-data 20 0 23564 5672 1108 S 0 0.0 0:01.33 apache2
20606 www-data 20 0 23564 5668 1104 S 0 0.0 0:00.39 apache2
20468 www-data 20 0 23564 5644 1080 S 0 0.0 0:00.80 apache2
20082 www-data 20 0 23564 5640 1072 S 0 0.0 0:00.98 apache2
9078 www-data 20 0 23564 5624 1044 S 0 0.0 0:00.61 apache2
So in this case my bacula tape backup is using about 200MB, snmpd is
using 34M, bind (named) is using 27M, mysql is using 12M. not much
going on. Lots of apache2 processes each using a bit under 6M.
The RES is how much is resident in memory. VIRT is the whole process
memory space but that includes shared libraries and memory mapped files
and other things, and not just the memory used.
Of course the kernel can also have network buffers and other things
using some memory, which won't show in top. I do expect in your case
something obvious to be using the memory though.
--
Len Sorensen
Reply to: