Solved: [mod_python] ModPython + Virtual Hosting Apache2 instance = poor performance.

Christopher Sean Hilton chris at vindaloo.com
Mon Mar 8 12:58:49 EST 2010


To call it solved would mean that I actually know what going on. This is more of a work around. Here's what I found:

Apache 2.0.63 + mod_python 3.3.1 + python 2.x (threaded) 

   yields poor performance under freebsd for static content and dynamic content using php5.

Changing from threaded python to non-threaded python fixes the performance issues.

Django requires threaded python.

Apache 2.2.21 + the threaded APR from devel/apr + mod_python 3.3.1 + python 2.6 with threads works!

There isn't much difference configuring Apache 2.2 compared to Apache 2.0 but the mod_python port isn't as helpful. It doesn't put the line:

     LoadModule python_module libexec/apache22/mod_python.so

Into the configuration.

Given that it should also include:

     <IfModule python_module>
     PythonOptimize Off
     PythonDebug Off
     </IfModule>

lines in also, that's okay.

Here's the output from Apache:

tatooine apache22 # httpd -V
httpd -V
Server version: Apache/2.2.14 (FreeBSD)
Server built:   Mar  8 2010 12:21:44
Server's Module Magic Number: 20051115:23
Server loaded:  APR 1.3.9, APR-Util 1.3.9
Compiled using: APR 1.3.9, APR-Util 1.3.9
Architecture:   32-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_FLOCK_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=128
 -D HTTPD_ROOT="/usr/local"
 -D SUEXEC_BIN="/usr/local/bin/suexec"
 -D DEFAULT_PIDLOG="/var/run/httpd.pid"
 -D DEFAULT_SCOREBOARD="/var/run/apache_runtime_status"
 -D DEFAULT_LOCKFILE="/var/run/accept.lock"
 -D DEFAULT_ERRORLOG="/var/log/httpd-error.log"
 -D AP_TYPES_CONFIG_FILE="etc/apache22/mime.types"
 -D SERVER_CONFIG_FILE="etc/apache22/httpd.conf"

-- Chris


----------------------------------------------------------------------------
                                       "There will be an answer, Let it be."
                                                          chris at vindaloo.com






More information about the Mod_python mailing list