The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Apache : low load but too high memory usage

Discussion in 'EasyApache' started by Webou, Nov 10, 2007.

  1. Webou

    Webou Member

    Joined:
    Jun 6, 2007
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    I have a VPS on which sometimes PHP files cause "Internal Server Error".
    I have apache 2.2 and php 5.2.4 , last version of cpanel.

    In my error log I have these messages :
    Code:
    (12)Cannot allocate memory: couldn't create child process: /opt/suphp/sbin/suphp for /home/...
    
    So, in ssh ps aux I can see that it's a multiplication of apache childs which causes a too high memory usage.

    My question is :

    Which parameter should I change to limit the number of child processes ?

    The aim of this is that the users get in queue, instead of seeing the "Internal server error".

    I searched for it, googled it, but could not find the answer.

    Thanks in advance,

    Michael
     
    #1 Webou, Nov 10, 2007
    Last edited: Nov 10, 2007
  2. AndyReed

    AndyReed Well-Known Member
    PartnerNOC

    Joined:
    May 29, 2004
    Messages:
    2,222
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Minneapolis, MN
    View /usr/lib/php.ini file and post "Resource Limits" parameters here.
     
  3. Webou

    Webou Member

    Joined:
    Jun 6, 2007
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    Hello and thanks for your help.

    Here it is :
    Code:
    ;;;;;;;;;;;;;;;;;;;
    ; Resource Limits ;
    ;;;;;;;;;;;;;;;;;;;
    
    max_execution_time = 30     ; Maximum execution time of each script, in seconds
    max_input_time = 60	; Maximum amount of time each script may spend parsing request data
    memory_limit = 32M      ; Maximum amount of memory a script may consume (8MB)


    May be the problem is that the VPS does not SWAP. Instead, it just denies the request when there is not enough available memory.
     
  4. Webou

    Webou Member

    Joined:
    Jun 6, 2007
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    This shows that it's the number of apache childs wich is the problem :
    Code:
    USER       PID %CPU %MEM   VSZ  RSS TTY      STAT START   TIME COMMAND
    root         1  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  1628  596 ?        Ss   Nov09   0:00 init [3]
    root     31765  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  1532  536 ?        Ss   Nov09   0:04 syslogd -m 0
    named    31779  0.0  [COLOR="SeaGreen"]0.0[/COLOR] 70868 5856 ?        Ssl  Nov09   0:12 /usr/sbin/named -
    root     31821  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  1456  384 ?        S    Nov09   0:00 /usr/sbin/courier
    root     31822  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  1804  608 ?        S    Nov09   0:00 /usr/libexec/cour
    root     31849  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  1804  368 ?        S    Nov09   0:00 /usr/libexec/cour
    root     31850  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  1804  368 ?        S    Nov09   0:00 /usr/libexec/cour
    root     31853  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  1804  368 ?        S    Nov09   0:00 /usr/libexec/cour
    root     31854  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  1804  368 ?        S    Nov09   0:00 /usr/libexec/cour
    root     31855  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  1804  368 ?        S    Nov09   0:00 /usr/libexec/cour
    root     32680  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  4016 1128 ?        Ss   Nov09   0:03 /usr/sbin/sshd
    root     32692  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  2080  792 ?        Ss   Nov09   0:00 xinetd -stayalive
    root     32712  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  2152 1120 ?        S    Nov09   0:00 /bin/sh /usr/bin/
    mysql    32738  2.3  [COLOR="Red"]0.4[/COLOR] 135016 34644 ?      Sl   Nov09  81:45 /usr/sbin/mysqld
    root      1353  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  1460  388 ?        S    Nov09   0:00 /usr/sbin/courier
    root      1354  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  1568  508 ?        S    Nov09   0:00 /usr/lib/courier-
    root      1368  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  1460  388 ?        S    Nov09   0:00 /usr/sbin/courier
    root      1369  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  1568  508 ?        S    Nov09   0:00 /usr/lib/courier-
    root      1376  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  1460  388 ?        S    Nov09   0:00 /usr/sbin/courier
    root      1377  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  1568  508 ?        S    Nov09   0:00 /usr/lib/courier-
    root      1387  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  1460  388 ?        S    Nov09   0:00 /usr/sbin/courier
    root      1388  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  1568  508 ?        S    Nov09   0:00 /usr/lib/courier-
    root      1823  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  6088 1380 ?        Ss   Nov09   0:01 pure-ftpd (SERVER
    root      1826  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  3576  916 ?        S    Nov09   0:00 /usr/sbin/pure-au
    root      1885  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  3576  912 ?        S    Nov09   0:00 /usr/sbin/pure-au
    root      3087  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  6536 4840 ?        S    Nov09   0:00 cpbandwd
    root      3088  0.1  0.1 13696 11080 ?       SN   Nov09   3:49 cpanellogd - slee
    mailman   3170  0.0  [COLOR="SeaGreen"]0.0[/COLOR] 10288 5076 ?        Ss   Nov09   0:00 /usr/local/bin/py
    mailman   3180  0.0  [COLOR="SeaGreen"]0.0[/COLOR] 10112 6680 ?        S    Nov09   0:00 /usr/local/bin/py
    mailman   3181  0.0  [COLOR="SeaGreen"]0.0[/COLOR] 10080 6692 ?        S    Nov09   0:00 /usr/local/bin/py
    mailman   3182  0.0  [COLOR="SeaGreen"]0.0[/COLOR] 10052 6692 ?        S    Nov09   0:00 /usr/local/bin/py
    mailman   3183  0.0  [COLOR="SeaGreen"]0.0[/COLOR] 10112 6680 ?        S    Nov09   0:00 /usr/local/bin/py
    mailman   3184  0.0  [COLOR="SeaGreen"]0.0[/COLOR] 10060 6712 ?        S    Nov09   0:00 /usr/local/bin/py
    mailman   3185  0.0  [COLOR="SeaGreen"]0.0[/COLOR] 10596 7236 ?        S    Nov09   0:00 /usr/local/bin/py
    mailman   3186  0.0  [COLOR="SeaGreen"]0.0[/COLOR] 10112 6676 ?        S    Nov09   0:00 /usr/local/bin/py
    mailman   3187  0.0  [COLOR="SeaGreen"]0.0[/COLOR] 10112 6676 ?        S    Nov09   0:00 /usr/local/bin/py
    root      3195  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  4052  804 ?        Ss   Nov09   0:00 /usr/sbin/saslaut
    root      3229  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  1488  396 ?        Ss   Nov09   0:00 /usr/sbin/portsen
    root      3404  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  6664 5044 ?        S    Nov09   0:10 /etc/authlib/auth
    root      8140  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  6664 5044 ?        S    Nov09   0:10 /etc/authlib/auth
    root     18148  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  6664 5044 ?        S    Nov09   0:08 /etc/authlib/auth
    root     21946  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  6664 5044 ?        S    Nov09   0:09 /etc/authlib/auth
    root     32579  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  6664 5044 ?        S    Nov09   0:10 /etc/authlib/auth
    root     17883  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  2484  944 ?        Ss   Nov10   0:00 crond
    root     27982  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  6716 5108 ?        S    Nov10   0:02 chkservd
    mailnull  9285  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  7616 2052 ?        Ss   Nov10   0:03 /usr/sbin/exim -b
    mailnull  9291  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  8532 2020 ?        Ss   Nov10   0:00 /usr/sbin/exim -t
    root      9298  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  3528 1520 ?        S    Nov10   0:02 antirelayd
    root     21691  0.0  [COLOR="Red"]0.3[/COLOR] 26636 25056 ?       S    Nov10   0:51 /usr/bin/perl /us
    root      3834  0.0  0.1 20804 10296 ?       S    01:59   0:04 cpsrvd - waiting
    root      9616  0.0  [COLOR="Red"]0.2[/COLOR] 43080 21432 ?       Ss   03:02   0:08 /usr/local/apache
    root      5235  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  7056 2396 ?        Rs   11:21   0:00 sshd: root@ttyp0
    root      5272  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  2288 1340 ttyp0    Ss   11:21   0:00 -bash
    arthur70  3868  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  6108 1100 ?        S    12:43   0:00 pure-ftpd (IDLE)
    timoline  1391  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  6200 1160 ?        S    13:05   0:00 pure-ftpd (IDLE)
    nobody    7434  0.0  [COLOR="Red"]0.2[/COLOR] 43336 21592 ?       S    13:10   0:00 /usr/local/apache
    nobody    7463  0.1  [COLOR="Red"]0.2[/COLOR] 43224 21296 ?       S    13:10   0:00 /usr/local/apache
    nobody    9307  0.1  [COLOR="Red"]0.2[/COLOR] 43220 21404 ?       S    13:11   0:00 /usr/local/apache
    nobody   11618  0.0  [COLOR="Red"]0.2[/COLOR] 43220 21428 ?       S    13:13   0:00 /usr/local/apache
    nobody   11632  0.1  [COLOR="Red"]0.2[/COLOR] 43224 21372 ?       S    13:13   0:00 /usr/local/apache
    nobody   11962  0.0  [COLOR="Red"]0.2[/COLOR] 43356 21444 ?       S    13:14   0:00 /usr/local/apache
    nobody   12018  0.0  [COLOR="Red"]0.2[/COLOR] 43232 21432 ?       S    13:14   0:00 /usr/local/apache
    nobody   14126  0.1  [COLOR="Red"]0.2[/COLOR] 43220 21296 ?       S    13:15   0:00 /usr/local/apache
    nobody   14127  0.0  [COLOR="Red"]0.2[/COLOR] 43224 21396 ?       S    13:15   0:00 /usr/local/apache
    nobody   15523  0.0  [COLOR="Red"]0.2[/COLOR] 43216 21412 ?       S    13:15   0:00 /usr/local/apache
    nobody   16165  0.0  [COLOR="Red"]0.2[/COLOR] 43216 21392 ?       S    13:16   0:00 /usr/local/apache
    nobody   17537  2.3  [COLOR="Red"]0.3[/COLOR] 53816 31928 ?       S    13:17   0:01 /usr/local/apache
    nobody   17875  0.0  [COLOR="Red"]0.2[/COLOR] 43216 21220 ?       S    13:17   0:00 /usr/local/apache
    nobody   17884  0.0  [COLOR="Red"]0.2[/COLOR] 43216 21396 ?       S    13:17   0:00 /usr/local/apache
    nobody   17885  0.0  [COLOR="Red"]0.2[/COLOR] 43224 21348 ?       S    13:17   0:00 /usr/local/apache
    nidaime  17912 27.6  0.1 23024 9748 ?        S    13:17   0:15 /usr/bin/php
    nobody   17995  0.0  [COLOR="Red"]0.2[/COLOR] 43216 21320 ?       S    13:17   0:00 /usr/local/apache
    nobody   18011  0.0  [COLOR="Red"]0.2[/COLOR] 43216 21364 ?       S    13:18   0:00 /usr/local/apache
    nobody   18066  0.0  [COLOR="Red"]0.2[/COLOR] 43216 21380 ?       S    13:18   0:00 /usr/local/apache
    zangdar  18167  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  6108 1056 ?        S    13:18   0:00 pure-ftpd (IDLE)
    nobody   18276  0.0  [COLOR="Red"]0.2[/COLOR] 43216 21260 ?       S    13:18   0:00 /usr/local/apache
    nobody   18428  0.0  [COLOR="Red"]0.2[/COLOR] 43212 21256 ?       S    13:18   0:00 /usr/local/apache
    root     19667  0.0  [COLOR="SeaGreen"]0.0[/COLOR]  2316  792 ttyp0    R+   13:18   0:00 ps aux
    
     
  5. AndyReed

    AndyReed Well-Known Member
    PartnerNOC

    Joined:
    May 29, 2004
    Messages:
    2,222
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Minneapolis, MN
    What is the guaranteed/Burst System Memory assigned to your VPS?
     
  6. Webou

    Webou Member

    Joined:
    Jun 6, 2007
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    It's 384Mo - 1 Go.

    The thing is that I have a lot of accounts (~700), so the memory goes easily up to 1Go, and when it happens, I have the "Internal Server Error".

    I'd like to avoid that...

    I counted the number of apache childs when I overuse memory, and it was 32. So I'd like to limit this number to 30. How can I do that?
     
    #6 Webou, Nov 12, 2007
    Last edited: Nov 12, 2007
  7. AndyReed

    AndyReed Well-Known Member
    PartnerNOC

    Joined:
    May 29, 2004
    Messages:
    2,222
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Minneapolis, MN
    With 700 client on a VPS, no surprise to hit the max of your RAM Memory very quick. Ask your host to increase your Memory to 2GB or more, if they have'em!
     
  8. Webou

    Webou Member

    Joined:
    Jun 6, 2007
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    Yes sure, upgrading would be the easiest thing to do :)

    But I'm looking for a solution with the present configuration. It should be possible to lower the number of apache childs, no?
     
  9. sehh

    sehh Well-Known Member

    Joined:
    Feb 11, 2006
    Messages:
    579
    Likes Received:
    5
    Trophy Points:
    18
    Location:
    Europe
    i encountered the same problem, i believe its because i compiled apache with the "worker" MPM instead of prefork.

    it seems the "worker" by default is set to use too much memory.
     
Loading...

Share This Page