reducing memory usage
I'm trying to tune things to fit within the somewhat limited ram I have available, but have been having a problem with apache and php chewing up gobs of ram. I found suggestons on the forum to use pmap to examine where a process is using it's ram.
It looks like with mm support for sessions compiled in, PHP automatically takes an extra 64MB of ram for mm storage even if you're not actually using MM. I've been unable to find anything about tuning this parameter, so I'm going to recompile without mm support.
root@none:~ # pmap -x 21060
21060: /usr/local/apache/bin/httpd -k start
Address Kbytes RSS Anon Locked Mode Mapping
08048000 596 - - - r-x-- httpd
080dd000 16 - - - rw--- httpd
080e1000 1476 - - - rwx-- [ anon ]
40000000 84 - - - r-x-- ld-2.3.2.so
40015000 4 - - - rw--- ld-2.3.2.so
4001b000 4 - - - rw--- [ anon ]
4001c000 64 - - - r-x-- libz.so.1.2.1.1
4002c000 4 - - - rw--- libz.so.1.2.1.1
4002d000 176 - - - r-x-- libssl.so.0.9.7
40059000 12 - - - rw--- libssl.so.0.9.7
4005c000 896 - - - r-x-- libcrypto.so.0.9.7
4013c000 72 - - - rw--- libcrypto.so.0.9.7
4014e000 12 - - - rw--- [ anon ]
40151000 80 - - - r-x-- libaprutil-0.so.0.9.6
40165000 4 - - - rw--- libaprutil-0.so.0.9.6
40166000 108 - - - r-x-- libexpat.so.0.1.0
40181000 8 - - - rw--- libexpat.so.0.1.0
40183000 124 - - - r-x-- libapr-0.so.0.9.6
401a2000 4 - - - rw--- libapr-0.so.0.9.6
401a3000 8 - - - rw--- [ anon ]
401a5000 24 - - - r-x-- librt-2.3.2.so
401ab000 4 - - - rw--- librt-2.3.2.so
401ac000 44 - - - rw--- [ anon ]
401b7000 128 - - - r-x-- libm-2.3.2.so
401d7000 4 - - - rw--- libm-2.3.2.so
401d8000 20 - - - r-x-- libcrypt-2.3.2.so
401dd000 4 - - - rw--- libcrypt-2.3.2.so
401de000 156 - - - rw--- [ anon ]
40205000 68 - - - r-x-- libnsl-2.3.2.so
40216000 4 - - - rw--- libnsl-2.3.2.so
40217000 8 - - - rw--- [ anon ]
40219000 52 - - - r-x-- libpthread-0.10.so
40226000 8 - - - rw--- libpthread-0.10.so
40228000 264 - - - rw--- [ anon ]
4026a000 8 - - - r-x-- libdl-2.3.2.so
4026c000 4 - - - rw--- libdl-2.3.2.so
4026d000 4 - - - rw--- [ anon ]
4026e000 1152 - - - r-x-- libc-2.3.2.so
4038e000 32 - - - rw--- libc-2.3.2.so
40396000 8 - - - rw--- [ anon ]
40398000 2296 - - - r-x-- libphp5.so
405d6000 896 - - - rw--- libphp5.so
406b6000 28 - - - rw--- [ anon ]
406bd000 12 - - - r-x-- libmm.so.13.0.20
406c0000 4 - - - rw--- libmm.so.13.0.20
406c1000 4 - - - r-x-- libpspell.so.15.0.3
406c2000 4 - - - rw--- libpspell.so.15.0.3
406c3000 116 - - - r-x-- libmhash.so.2.0.0
406e0000 4 - - - rw--- libmhash.so.2.0.0
406e1000 164 - - - r-x-- libmcrypt.so.4.4.7
4070a000 12 - - - rw--- libmcrypt.so.4.4.7
4070d000 24 - - - rw--- [ anon ]
40713000 24 - - - r-x-- libltdl.so.3.1.0
40719000 4 - - - rw--- libltdl.so.3.1.0
4071a000 88 - - - r-x-- libgd.so.2.0.23
40730000 124 - - - rw--- libgd.so.2.0.23
4074f000 16 - - - rw--- [ anon ]
40753000 392 - - - r-x-- libfreetype.so.6.3.5
407b5000 28 - - - rw--- libfreetype.so.6.3.5
407bc000 760 - - - r-x-- libX11.so.6.2
4087a000 12 - - - rw--- libX11.so.6.2
4087d000 56 - - - r-x-- libXpm.so.4.11
4088b000 4 - - - rw--- libXpm.so.4.11
4088c000 136 - - - r-x-- libpng12.so.0.1.2.5
408ae000 4 - - - rw--- libpng12.so.0.1.2.5
408af000 112 - - - r-x-- libjpeg.so.62.0.0
408cb000 4 - - - rw--- libjpeg.so.62.0.0
408cc000 56 - - - r-x-- libresolv-2.3.2.so
408da000 4 - - - rw--- libresolv-2.3.2.so
408db000 8 - - - rw--- [ anon ]
408dd000 32 - - - r-x-- libnss_files-2.3.2.so
408e5000 4 - - - rw--- libnss_files-2.3.2.so
408e6000 12 - - - r-x-- libnss_dns-2.3.2.so
408e9000 4 - - - rw--- libnss_dns-2.3.2.so
408ea000 896 - - - r-x-- libxml2.so.2.6.11
409ca000 32 - - - rw--- libxml2.so.2.6.11
409d2000 36 - - - rw--- [ anon ]
409db000 544 - - - r-x-- libaspell.so.15.0.3
40a63000 56 - - - rw--- libaspell.so.15.0.3
40a71000 4 - - - rw--- [ anon ]
40a72000 636 - - - r-x-- libstdc++.so.5.0.7
40b11000 88 - - - rw--- libstdc++.so.5.0.7
40b27000 20 - - - rw--- [ anon ]
40b2c000 32 - - - r-x-- libgcc_s.so.1
40b34000 4 - - - rw--- libgcc_s.so.1
40b35000 28 - - - r-x-- libnss_compat-2.3.2.so
40b3c000 4 - - - rw--- libnss_compat-2.3.2.so
40b3d000 32 - - - r-x-- libnss_nis-2.3.2.so
40b45000 4 - - - rw--- libnss_nis-2.3.2.so
40b46000 65536 - - - rw-s- session_mm_apache2handler0.mem
44b46000 56 - - - rw-s- zero (deleted)
44b54000 152 - - - r-x-- eaccelerator.so
44b7a000 8 - - - rw--- eaccelerator.so
44b7c000 1024 - - - rw-s- [ shmid=0x58000 ]
bfffb000 20 - - - rwx-- [ stack ]
-------- ------- ------- ------- -------
total kB 80408 - - -
2 Replies
@gmt:
Reducing the number of httpd processes is the easiest way to free memory. They seem to start at 10M for me and keep growing. I have to regularly restart apache.
I don't see my apache processes using nearly that much memory.
My apache usage is light though.
Setting MaxRequestsPerChild is better than restarting all of apache.