Use the display-name option as documented in mod_wsgi documentation to label the mod_wsgi daemon processes. That way you can see with 'ps' if the large processes are in fact the mod_wsgi daemon processes.
http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIDaemonProcess
If they are quite fat, then Apache or mod_wsgi isn't anything to do with it. It is going to be because your applications are themselves fat. This may be because of excessive caching of data in memory or resource leakage.
If the labelled mod_wsgi daemon mode processes aren't fat, then you may have not delegated the Python applications to run in the daemon processes properly. That or your PHP application is the problem.
http://code.google.com/p/modwsgi/wiki/CheckingYourInstallation#Embedded_Or_Daemon_Mode
In short, when your application is fat, it isn't going to matter what hosting mechanism you use, they will still be fat and Apache and mod_wsgi have got nothing to do with it unless you have stuffed up the Apache configuration.
You are using ITK MPM for Apache. You will need to be using mod_wsgi 3.3 or later, which contains fix:
When compiled against ITK MPM for Apache, if using daemon mode, the
listener socket for daemon process will be marked as being owned by
the same user that daemon process runs. This will at least allow a
request handled under ITK MPM to be directed to daemon process owned
by same user as script. See issue:
http://code.google.com/p/modwsgi/issues/detail?id=187
You cannot though just use binary supplied by operating system as those available are likely only going to be for worker and prefork MPM. For ITK MPM you will need to compile mod_wsgi from source code and you MUST have the appropriate headers files for the ITK MPM installed and not those for worker or prefork MPM. This is because mod_wsgi source code has:
if (!geteuid()) {
#if defined(MPM_ITK)
if (chown(process->socket, process->uid, -1) < 0) {
#else
if (chown(process->socket, ap_unixd_config.user_id, -1) < 0) {
#endif
ap_log_error(APLOG_MARK, APLOG_ALERT, errno, wsgi_server,
"mod_wsgi (pid=%d): Couldn't change owner of unix "
"domain socket '%s'.", getpid(),
process->socket);
return -1;
}
}
IOW, it is a compile time choice as to how to setup permissions with it only being set for ITK MPM correctly if ITK MPM headers are installed properly and so MPM_ITK #define found.
In summary, you will need to do the following:
(1) Ensure that ITK MPM header files installed. If using binary package for Apache, see if there is an ITK variant of the Apache dev package.
(2) Compile and install mod_wsgi from source code available in publically downloadable mod_wsgi 3.3 source package
The mod_wsgi source code package and installation instructions are available from:
http://www.modwsgi.org
Best Answer
From the link you have given;
This is the only requirement they have given. You can use an existing path the meets these requirements or create a new one.
The file,
/etc/httpd/run/httpd.pid
, is correct for Apache under Red Hat and derivatives. This location is defined in/etc/httpd/conf/httpd.conf
. (If this location is changed,PIDFILE
in/etc/sysconfig/httpd
must be updated to match.)I would go ahead and set
WSGISocketPrefix
to the same path as the Red Hat location. However, you should be able to use/var/run/wsgi
, if you wish. You just need to create the directory and assign permissions yourself.