Monday, February 12, 2018

Apache with prefork model using 1000 MB memory per process

I am currently working on a site which uses Apache running on the prefork memory model. The following is the configuration from httpd.conf




 
StartServers 30
MinSpareServers 15
MaxSpareServers 30
MaxClients 96
ServerLimit 512
MaxRequestsPerChild 0




The following is a sample line from top



PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND           
29261 apache 15 0 1003m 231m 53m S 16.3 2.9 1:47.68 httpd


The following are the loaded apache modules



core prefork http_core mod_so mod_auth_basic mod_authn_file 

mod_authz_host mod_authz_user mod_include mod_log_config
mod_logio mod_env mod_ext_filter mod_mime_magic mod_expires
mod_deflate mod_headers mod_usertrack mod_setenvif mod_mime
mod_status mod_autoindex mod_info mod_vhost_alias mod_negotiation
mod_dir mod_actions mod_alias mod_rewrite mod_cgi mod_version
mod_realip2 mod_php5 mod_ssl


I am not sure if all of these modules are used.




The following are the php extensions loaded



date, libxml, openssl, pcre, zlib, bz2, calendar, ctype, 
curl, hash, filter, ftp, gettext, gmp, session, iconv,
posix, Reflection, standard, shmop, SimpleXML, SPL, sockets,
exif, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xml,
apache2handler, memcache, uploadprogress, dbase, dom,
eAccelerator, gd, json, mbstring, mcrypt, memcached, mongo,
mysql, mysqli, newrelic, PDO, pdo_mysql, pdo_sqlite, xmlreader,
xmlwriter, xsl, zip



Why would apache be using so much memory per process? Is ti because of these modules? If so are there memoryhogs in there which I can start looking at to see if they are being used? Or could it be because of the php extensions? Any memoryhogs in there?



The php memory limit is set to 256MB.



Eaccelerator is configured with 512MB memory.



The server is not able to handle even slightly above average loads as swap usage starts as soon as traffic increases making the system unresponsive. The server has a total of 8GB of RAM and it is a dedicated quad core server.




Thanks in advance for any help in solving this problem.

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...