You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2013/05/21 22:44:25 UTC

[Bug 55000] New: Memory usage per process doubles when Apache is compiled with --enable-pie

https://issues.apache.org/bugzilla/show_bug.cgi?id=55000

            Bug ID: 55000
           Summary: Memory usage per process doubles when Apache is
                    compiled with --enable-pie
           Product: Apache httpd-2
           Version: 2.2.24
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
          Assignee: bugs@httpd.apache.org
          Reporter: darknovanick@gmail.com
    Classification: Unclassified

I've been trying to track down why the same web pages running on one server use
far less memory than another server. This process has lead me to eventually
discover how a difference in how Apache is compiled has made a huge difference.

The problem server is running CentOS (RedHat Enterprise clone) 5.9. gcc is
version 4.1.2. php is 5.3.3 and I am using mod_php with Apache.

httpd is running in prefork mode.

My web application is Magento, which is a PHP application. I am running APC
along with that. I have a test script that throws several thousands of URLs at
the server.

I am measuring httpd's memory usage with
http://www.pixelbeat.org/scripts/ps_mem.py which takes into account shared
memory. Slightly different but pretty close results can be found with the line:

ps -ef | grep httpd | grep -v ^root | awk '{ print $2 '} | xargs pmap -d | grep
^mapped: | awk '{ print $4 }' | cut -dK -f1 | awk '{ SUM += $1} END { print
SUM/NR }'

For test purposes, I have httpd configured with MaxClients 10 and
MaxRequestsPerChild 0 so that the memory problem appears more quickly.

I first noticed this problem with CentOS's stock httpd, which is a patched
version of 2.2.3, but I have reproduced it with 2.2.24 to eliminate the
possibility that it has already been fixed.

I compiled 2.2.24 with:
./configure --prefix=/tmp/httpd-install --enable-pie --enable-mods-shared=all
--enable-ssl --with-ssl

I let it run on my test URLs and after 1+ hours, it stabilizes on a memory
usage of around 110 MB per process.

At first I thought there was a problem with PHP, but further investigation
found that PHP's memory usage was a small fraction of this usage per child. I
started changing configure options and eventually found that compiling 2.2.24
with:

./configure --prefix=/tmp/httpd-install --enable-mods-shared=all --enable-ssl
--with-ssl 

And running with the same URLs in a similar way, stabilizes on a memory usage
of around 60 MB per process.

This is 100% reproducible on this system, I have tried 2.2.3, 2.2.22 and
2.2.24. These particular figures come from a test that didn't have any
non-Apache-provided modules enabled except for mod_php.

I have tried playing with the --enable-pie option on a debian system, and have
not been able to see much difference.

On this redhat system, adding the --enable-pie option causes usage to about
double, which is huge. On my actual production box, there can be over 100 child
processes, and having each one with double the memory usage is a big problem.

I have been researching the --enable-pie option and am at a loss as to why that
would cause such a memory jump.

I also do not know if another PHP application, or running httpd without PHP,
would see the same memory doubling or not.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 55000] Memory usage per process doubles when Apache is compiled with --enable-pie

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55000

darknovanick@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|darknovanick@gmail.com      |

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 55000] Memory usage per process doubles when Apache is compiled with --enable-pie

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55000

darknovanick@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |darknovanick@gmail.com

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 55000] Memory usage per process doubles when Apache is compiled with --enable-pie

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55000

darknovanick@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |darknovanick@gmail.com

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org