Search code examples
apachememory-leaksserver-configurationosqa

OSQA apache memory footprint


I have an OSQA (python / django q&a application) installation serving 8 different sites. The sites are all in development, receiving minimal traffic. The server is a virtual private server with 512 mb of ram.

Apache is only serving dynamic pages with mod_wsgi behind Nginx. I can't stop Apache consuming more and more memory with each request until the server chokes.

I experimented with the configuration parameters without much luck to minimize the memory footprint. With the following mpm_prefork parameters in apache2.conf:

StartServers          2
MinSpareServers       1
MaxSpareServers       4
MaxClients            4
MaxRequestsPerChild 100

2 apache processes start using 4 mb and after the first request there are 4 processes with each nearly 50 mb and with each new request those 4 processes climb steadily up to nearly 200 mb each.

I feel like there is something wrong going on. Any suggestions are greatly appreciated.


Solution

  • KeepAlive Off
    MaxSpareThreads 3
    MinSpareThreads 1
    ServerLimit 3
    SetEnvIf X-Forwarded-SSL on HTTPS=1
    ThreadsPerChild 2
    
    WSGIDaemonProcess osqaWSGI processes=2 python-path=/web/osqa_server:/web/osqa_server/lib/python2.6 threads=1 maximum-requests=550
    WSGIProcessGroup osqaWSGI
    

    Ran httperf against this with 10,000 concurrent hits and it was still standing.