On Aug 3, 9:16 pm, Aljosa Mohorovic <[EMAIL PROTECTED]>
wrote:
> on few blogs/web sites it is stated that > 30 django sites on one
> server running apache/mod_pythonhave some issues, like untraceable
> errors and wrong site displaying for some domain.
> any comments on this?
>
> i have many small php sites that will eventually became django sites,
> how should i deploy?

For a related discussion on why running multiple sites, even if in
distinct sub interpreters, using mod_python or embedded mode of
mod_wsgi can cause problems, see:

  http://blog.dscpl.com.au/2007/07/web-hosting-landscape-and-modwsgi.html

In short however, the main problems are as follows:

1. A C extension module is loaded only once per process no matter how
many sub interpreters there are. Thus, if different applications try
and load different versions of a C extension module problems will
arise in the use of that module. This is because the first application
to load its version will win, and other applications using different
versions may find their Python wrapper code for that extension module
will not match, leading to fatal or subtle problems.

2. Some C extension modules are not written properly so as to cope
with being able to be used from multiple sub interpreters at the same
time. Problems can be caused by the C extension module caching data
from one sub interpreter then using it in a different sub interpreter.
This may result in mixing of data between sub interpreters, if for
example each applications is modifying the cached data. If the cached
data is a Python class type from which object instances are created,
then objects created from it which are passed to a different sub
interpreter will fail isinstance() checks and potentially use the
wrong code base. This latter problem has been found with psycopg2 and
will affect Django from subversion repository.

In other words, if all your applications use exactly the same code
base and thus versions of C extension modules you may be okay, but not
if the C extension modules haven't been written properly to work with
multiple sub interpreters.

The safest way is to use a mechanism whereby each application is run
in a different process. This is why fastcgi solutions work okay, as
they force this behaviour. The other alternative now also available
for Apache is to use daemon mode of mod_wsgi (www.modwsgi.org). This
also optionally allows applications to be delegated to a distinct
process, thereby ensuring they can't interfere with other
applications. For specific notes on using Django with mod_wsgi see:

  http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango

Also see:

  http://code.google.com/p/modwsgi/wiki/IntegrationWithTrac

which includes some more interesting examples of using mod_wsgi daemon
mode with lots of sites.

If using mod_python, would also in general suggest that you ensure you
are using mod_python 3.3.1 and not some older version.

Graham


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to