Results 1 to 10 of 10
  1. #1

    Question Apache eating too much memory

    Hi People
    I was running Apache 2 in a Centos 4.3. Recently I upgraded from PHP 4 to PHP 5 because a script needed PHP 5.
    Always when I did a free I had at least 500MB free and the apache process had 15M.
    Now all the process start at 20M and then grow to 30M and the free memory goes down to 0 in ten minutes after starting apache.

    I've limited in php.ini to 10M the memory that a script can take. But in the previous configuration was at 30M with no problems.

    My forum users also reports that the forusm are considerably slower.

    Any ideas of what is going wrong?.

    best regards,

  2. #2

    Smile screenshots

    here it is one screenshot.
    and another one after apachectl restart
    Attached Thumbnails Attached Thumbnails ScreenShot268.jpg   ScreenShot267.jpg  

  3. #3
    Join Date
    Jun 2003
    Janesville, Wi
    Obviously PHP5 requires more RAM than PHP4. Newer software is built to specifications and needs of today and not days gone by. That usually means more processing power and RAM needed.

    The solution to this is to add more RAM to the server. It's the only option you have aside from making the script work with PHP4.

  4. #4
    Why do you use php5? There are a lot of advantages in using php4

  5. #5
    Join Date
    Jun 2003
    Janesville, Wi
    Quote Originally Posted by strom
    Recently I upgraded from PHP 4 to PHP 5 because a script needed PHP 5.
    NameServer: Read the above quote please.

  6. #6
    Join Date
    Dec 2005
    There is no memory problem here; even when you're down to 16MB free RAM, about half of your memory is allocated to "buffers". That means that the kernel is caching files into memory to make them load faster, but if another program needs that memory, it will be freed for that program.

    In fact this is the way Linux is supposed to operate; a Linux system that has been running for a while without restarting any services will have virtually no "free" memory. That is a good thing though -- what good is memory that's not being used? You can see this more clearly with "free -m". The line that reads "-/+ buffers/cache" shows how much used and free memory you have without taking those buffers into account, and it will show you that you still have *plenty* left.

    As to why your forums are loading more slowly, that's difficult to say, because there are so many factors that could affect it. For starters, how did you compile PHP5?

  7. #7
    Hi People,
    thanks very much for the responses.

    I assumed there was a problem because everybody is complaining about how slow is the SMF forums.

    I upgraded to php 5 to install Joomla 1.5 that requieres php 5, I really regret it.

    I didn't install php 5 from the source, I just did yum update php and I activate the Plus packages of Centos 4.3

    Can I revert back to php 4 that was a error free panacea?.
    I'm also getting Pear errors in the logs.

    Best regards from buenos aires,

  8. #8
    Join Date
    Dec 2005
    Last I checked, the PHP in the CentOS Plus repo were 5.0.x. You should try out 5.1.6 before reverting back to PHP 4.

    Anytime I need a newer package than what CentOS offers I try the latest Fedora Development SRPM and recompile it on a second CentOS box. All you should need to do in most cases is an "rpmbuild --rebuild package.src.rpm".

  9. #9
    Join Date
    Jul 2005
    Atlanta, GA
    Take a look at the "apachectl status" command , or set up a URL with:

      <Location /status>
        SetHandler server-status
        Order deny,allow
        Deny from all
        Allow from your.ip.add.ress
    If it turns out most of your apache processes are idle most of the time, then you can simply reduce the MaxServer settings in your Apache config.

    You can also reduce the KeepAliveTimeout so that the processes aren't tied up as long. Worst case, that would slow things down a tiny bit (because browsers would have to reconnect more often), but that's nothing compared to the slowdown when you run out of memory and the system has to swap to disk.

    <<Signature to be setup in your profile>>
    Last edited by anon-e-mouse; 10-25-2006 at 10:02 PM.

  10. #10
    As mentioned, there is no memory issue here based on what I can see with the screenshots. ~500MB of your memory got allocated for buffers which are freed when your application needs it. Basically, you can say you have 500MB free memory for your applications. The reason your forums are running slow can depend on many factors, but I doubt it is memory related.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts