Httpd eating a lot of RAM

Discussion in 'Site & Server Administration' started by applehost, Aug 16, 2012.

  1. #1
    Hi everyone,

    I currently have a server with Httpd installed on it. I have 6GB of RAM and some good CPU Power. I use CentOS as my server OS. Right now, I am having problems with a program called Centova Cast. After someday, Centova Crashed because there is no RAM left. I then decided to investigate. The first thing I found was that my httpd process was using almost 50% (3GB) of my RAM after some day of use. The thing is, there is only one website on my server and it is not really used (Only when modifying some settings on my radios).

    Here is the output of top -M :

    top - 09:15:51 up 4 days, 8:31, 2 users, load average: 0.83, 0.81, 0.68
    Tasks: 154 total, 2 running, 152 sleeping, 0 stopped, 0 zombie
    Cpu(s): 2.7%us, 0.0%sy, 0.0%ni, 94.8%id, 0.1%wa, 0.0%hi, 0.1%si, 2.2%st
    Mem: 5465088k total, 5441120k used, 23968k free, 26428k buffers
    Swap: 2096472k total, 112k used, 2096360k free, 2634920k cached

    PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
    9130 apache 15 0 528m 307m 3692 S 0.0 5.8 0:19.55 httpd
    9131 apache 16 0 527m 306m 3620 S 0.0 5.7 0:19.97 httpd
    18286 apache 15 0 526m 305m 3692 S 0.0 5.7 0:19.11 httpd
    9133 apache 16 0 525m 304m 3676 S 0.0 5.7 0:19.00 httpd
    9129 apache 16 0 524m 302m 3716 S 0.0 5.7 0:20.33 httpd
    9132 apache 15 0 522m 301m 3712 S 0.0 5.6 0:19.08 httpd
    21917 apache 16 0 513m 292m 3712 S 0.0 5.5 0:17.64 httpd
    22585 apache 16 0 512m 290m 3612 S 0.0 5.4 0:18.06 httpd
    1265 root 11 -10 38936 32m 1740 S 0.0 0.6 0:00.01 iscsiuio
    1876 mysql 15 0 254m 30m 4516 S 0.0 0.6 15:46.55 mysqld
    2858 root 19 0 52940 10m 5716 S 0.0 0.2 18:41.36 ts3server_linux
    1928 root 18 0 228m 9340 5532 S 0.0 0.2 0:01.14 httpd
    1793 ntp 15 0 23412 5048 3920 S 0.0 0.1 0:01.67 ntpd
    29050 centovac 15 0 33624 4328 1660 S 0.0 0.1 7:19.14 ices
    1832 centovac 15 0 32860 4060 1668 S 0.0 0.1 16:41.86 ices
    22011 centovac 15 0 32924 3980 1660 S 2.3 0.1 21:15.74 ices
    29353 centovac 15 0 33068 3880 1660 S 2.3 0.1 24:11.20 ices
    2143 centovac 15 0 32940 3792 1660 S 0.0 0.1 42:56.07 ices
    1745 haldaemo 16 0 30768 3760 1532 S 0.0 0.1 0:00.10 hald
    29298 centovac 15 0 32516 3740 1660 S 0.0 0.1 15:50.11 ices
    21865 root 15 0 90972 3688 2932 S 0.0 0.1 0:00.37 sshd
    22597 root 15 0 90192 3688 2932 S 0.0 0.1 0:00.01 sshd


    Here are the modules installed on my server (found using httpd -M):

    [root@quote116740 conf]# httpd -M
    Loaded Modules:
    core_module (static)
    mpm_prefork_module (static)
    http_module (static)
    so_module (static)
    auth_basic_module (shared)
    auth_digest_module (shared)
    authn_file_module (shared)
    authn_alias_module (shared)
    authn_anon_module (shared)
    authn_dbm_module (shared)
    authn_default_module (shared)
    authz_host_module (shared)
    authz_user_module (shared)
    authz_owner_module (shared)
    authz_groupfile_module (shared)
    authz_dbm_module (shared)
    authz_default_module (shared)
    ldap_module (shared)
    authnz_ldap_module (shared)
    include_module (shared)
    log_config_module (shared)
    logio_module (shared)
    env_module (shared)
    ext_filter_module (shared)
    mime_magic_module (shared)
    expires_module (shared)
    deflate_module (shared)
    headers_module (shared)
    usertrack_module (shared)
    setenvif_module (shared)
    mime_module (shared)
    dav_module (shared)
    status_module (shared)
    autoindex_module (shared)
    info_module (shared)
    dav_fs_module (shared)
    vhost_alias_module (shared)
    negotiation_module (shared)
    dir_module (shared)
    actions_module (shared)
    speling_module (shared)
    userdir_module (shared)
    alias_module (shared)
    rewrite_module (shared)
    proxy_module (shared)
    proxy_balancer_module (shared)
    proxy_ftp_module (shared)
    proxy_http_module (shared)
    proxy_connect_module (shared)
    cache_module (shared)
    suexec_module (shared)
    disk_cache_module (shared)
    file_cache_module (shared)
    mem_cache_module (shared)
    cgi_module (shared)
    version_module (shared)
    php5_module (shared)
    proxy_ajp_module (shared)
    Syntax OK


    I would like to know why is it using that much memory and how could I fix this. Is there anybody out there with the same problem?

    Regards,
     
    applehost, Aug 16, 2012 IP
  2. TiffanyJ.SSS

    TiffanyJ.SSS Member

    Messages:
    72
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    33
    #2
    we always ran reverse proxies and use varnish/nginx for caching content for faster load times and less memory usage
     
    TiffanyJ.SSS, Aug 16, 2012 IP
  3. Ray Baron

    Ray Baron Member

    Messages:
    148
    Likes Received:
    10
    Best Answers:
    3
    Trophy Points:
    43
    #3
    Of course, varnish & nginx do nothing if there is only one website that is hardly gets any traffic. :eek:

    Your resident memory (RES) seems quite high -- normal would be in the 20M to maybe 100M range -- so you can start investigating there. You need to ensure that your apache configuration is optimized. What mode is apache running in; what are your configuration parameters; what flavor and configuration of PHP?

    You can also track down what libraries, modules, processes, etc, are eating up memory using PMAP: http://www.gnutoolbox.com/pmap-command/
     
    Ray Baron, Aug 16, 2012 IP
  4. whrsstech

    whrsstech Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You might need to tweak Apache and the streaming server to perform better. I have a link to blog, but unfortunately I am unable to post the URL since I am a noob to DP.
     
    whrsstech, Aug 17, 2012 IP