#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2004
    Location
    Marbella, Spain
    Posts
    381
    Rep Power
    0

    Urgent max memory reached in hosting


    Hi, not sure this should go here.
    I am having troubbles with my shared host. On the 6th january they migrated my site to another server.
    On the 13th when I wanted to enter my password protected directory It got an Error 500 page, also I had problems with emails not working. This I reported to the host and cpanel had it fixed some hours later. Some days later I reported that awstat gives stats to low and mentioned that sometimes when I opened my chat I see Internal server error and I have to refresh the page and then its ok.

    Yesterday morning at 8.00 having breakfast, I opened chat and had internal server error and had to refresh several times to get it ok.
    I went directly to my error log and had errors like this:
    [Wed Jan 18 00:01:43 2012] [error] [client 80.174.72.31] File does not exist: /home/mysite/public_html/500.shtml, referer: http://www.myweb.com/chat/live.php
    [Wed Jan 18 00:01:43 2012] [error] [client 80.174.72.31] (12)Cannot allocate memory: couldn't create child process: /opt/suphp/sbin/suphp for /home/mysite/public_html/chat/admin_connect.php, referer: http://www.myweb.com/chat/live.php
    also like this wich is a webpage and not the chat but loading the chat image:
    [Wed Jan 18 00:19:42 2012] [error] [client 83.49.242.50] File does not exist: /home/mysite/public_html/500.shtml, referer: http://www.myweb.com/espanol/banana_beach_apartamento_primera_linea_playa.htm
    [Wed Jan 18 00:19:42 2012] [error] [client 83.49.242.50] (12)Cannot allocate memory: couldn't create child process: /opt/suphp/sbin/suphp for /home/mysite/public_html/chat/image.php, referer: http://www.myweb.com/espanol/banana_beach_apartamento_primera_linea_playa.htm

    [Wed Jan 18 00:18:00 2012] [error] [client 89.85.181.189] File does not exist: /home/mysite/public_html/500.shtml, referer: http://www.myweb.com/

    I reported this to the host, and of course it was due of the chat taking a lot of memory.

    After studying resourge usage for last 30 days in cpanel I was able to prove that I reached max memory usage often since 13th january (same day as the other 500 error but) and it also happened at nighttime when my pc was shut down and the chat pages was closed, its true it takes cpu and memory, but not that much.

    Anyway he insist is not a bug a tell me to hire a webdeveloper......

    Anyway, Can anybody tell me if its posible to have such a low average memory usage and such a high max memory usage.
    Below you can see one entry for the 6th january and one for 19th january with almost same average usage but the difference in max is more than 5 times higher:

    Code:
     
    From             To    aCPU   mCpu   aEP   mEP   lEP   aMEM   mMEM   lMEM   MemF   MepF 
    01-19 07:00 01-19 08:00   0   10      0   1      20    2.2M 384.0M  384.0M    3     0 
    01-07 11:00 01-07 12:00   0   10      0   2      20    1.9M 70.6M 384.0M    0      0
    
    aMEM                   : Average Memory Usage
    mMEM                   : Max Memory Usage
    lMEM                   : Memory Limit
    MemF                   : Out Of Memory Faults
    Thanks in advance
    Also I am getting some error 406 and think its a bit strange.
    Last edited by helenp; January 19th, 2012 at 02:52 PM.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2004
    Location
    Marbella, Spain
    Posts
    381
    Rep Power
    0
    Also If somebody can explain whatīs taking memory usage, for exampel images takes memory usage or only bandwith?
  4. #3
  5. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,316
    Rep Power
    7171
    Can anybody tell me if its posible to have such a low average memory usage and such a high max memory usage
    Certainly it is possible, an average has no direct mathematical relationship to an average.

    With PHP scripts every script operates independently. You could have just one script that uses 400MB of memory and it would still push your maximum to 400MB even if it was only requested once.

    Also If somebody can explain whatīs taking memory usage, for exampel images takes memory usage or only bandwith?
    It's not possible to explain what is using the memory without analyzing and testing the scripts.

    Loading an entire image into memory will consume a lot of memory. Sending it to the user takes considerably less bandwidth (due to compression) than memory. Sending it directly to the user without first loading the whole image into memory takes considerably less memory (due to not needing to decompress it).
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  6. #4
  7. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,131
    Rep Power
    4304
    I don't know much about web server hardware requirements.

    As far as I know, images would only take up a lot of memory if memcached (or something like it) was being used to keep them cached in memory.

    If you're using shared web hosting, you might want to also consider upgrading to a better hosting plan or finding a new host.
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2004
    Location
    Marbella, Spain
    Posts
    381
    Rep Power
    0
    Thanks,
    let see, I dont use any memcached images donīt even know what is, suppose is done with php.
    This is my htaccess:
    AddType application/x-httpd-php5 .htm .html
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^mysite\.com
    RewriteRule (.*) http://www.mysite/$1 [R=301,L]
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteCond %{REQUEST_FILENAME}.jgz -f
    RewriteCond %{HTTP_USER_AGENT} !MSIE\s[56]\.\d+;\sWindows
    RewriteRule (.*)(\.js|\.css)$ $1$2.jgz [L]
    AddType "application/x-javascript" .js.jgz
    AddType "text/css" .css.jgz
    AddEncoding gzip .jgz
    <FilesMatch "\.(gif|jpeg|jgz|gz|jpg|js|pdf|css|GIF|png|flv|swf|ico)$">
    Header set Cache-Control: "max-age=29030400"
    </FilesMatch>
    <FilesMatch "\.(pl|txt|htm|html|[sf]?cgi|spl)$">
    Header set Cache-Control: "max-age=7200"
    </FilesMatch>
    <FilesMatch "\.(js|css|jgz|gz)$">
    Header append Vary Accept-Encoding
    </FilesMatch>
    <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|jgz)$">
    Header unset Last-Modified
    </FilesMatch>
    Header unset ETag
    FileETag None

    What I cant understand I if I a have not done any changes in any script since the 13th, why would a script take that much memory, and only suddenly, as if a movie were switched on?
    Its true we have more visitors, but not that many, maybe we gone from 250 to 350 some days, not all days as weekends for exampel have less than a tuesday etc.
    Last edited by helenp; January 20th, 2012 at 01:56 AM.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2004
    Location
    Marbella, Spain
    Posts
    381
    Rep Power
    0
    I forgot, last night late there are always hardly nobody visitng the web, so I were doing tests, opening chat, viewing pages to see if something strange happened, using the searcherbox, the calculator etc. Suddenly when I refresed last 10 minutes resourge usage it had gone up to max. so I entered a page I ever enter and say a bot have been visiting, and as far as I know bots normally takes bandwith, not memory, but if it is as you say a php script then it can happen, but I tried all pages with php script and it didnt happen when I opened them.
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2004
    Location
    Marbella, Spain
    Posts
    381
    Rep Power
    0
    Just did another test and dont understand, I can see I am alone again as its very early, checking last visitors I was the only one, I opened all pages with php and mysql scripts and I got this, viewing last 10 minutes, so I have it by minute:
    From ▾ To aCPU mCpu aEP mEP lEP aMEM mMEM lMEM MemF MepF
    01-20 00:15 01-20 00:20 0 10 0 0 20 72K 1.1M 384.0M 0 0
    01-20 00:19 01-20 00:20 0 10 0 1 20 296K 1.6M 384.0M 0 0
    01-20 00:20 01-20 00:21 0 10 0 0 20 184K 1.2M 384.0M 0 0
    01-20 00:22 01-20 00:23 0 10 0 0 20 96K 1.1M 384.0M 0 0
    01-20 00:23 01-20 00:24 0 10 0 1 20 612K 1.1M 384.0M 0
    As you can see no high max number, but if I am alone how can the average be 96k and max 1.1m?

IMN logo majestic logo threadwatch logo seochat tools logo