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

Graham Dumpleton graham.dumpleton at gmail.com
Mon Mar 8 17:50:31 EST 2010


On 9 March 2010 04:58, Christopher Sean Hilton <chris at vindaloo.com> wrote:
> 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.

It should perhaps be qualified that Django doesn't require threads to
work and the conservative would run it in single threaded prefork MPM.
Whether it expects the threading module to still be importable is a
different matter though.

> 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

That is not a valid option to PythonOptimize and with that value
results would be unpredictable. It is off by default anyway.

>     PythonDebug Off

This is also off by default.

>     </IfModule>

In other words, you didn't need either of those definitions.

Graham

> 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
>
>
>
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>



More information about the Mod_python mailing list