On Sep 26, 10:27 am, "Benjamin Slavin" <[EMAIL PROTECTED]>
wrote:
> On 9/25/07, Mike Scott <[EMAIL PROTECTED]> wrote:
>
> > It should be threadsafe - [... ] web applications [...] pretty much
> > [become] a threaded application
>
> Mike,
>
> There are two issues here.  Thread safe and concurrent operation, and
> they are very different issues (though there is overlap).
>
> Django DOES supports concurrent operation (separate processes on the
> same or multiple servers).
>
> Django DOES NOT support threaded operation (and from what I've
> gathered in past discussions on this list, is not likely to).

Can you find the discussions on Google groups and post references to
them.

> This is why Apache must be configured to use the prefork model instead
> of the worker model.

In which case there should also be a warning that Django cannot be
used with Apache/mod_python on Windows as the Apache winnt MPM is also
multithreaded. Also, why  are there instructions posted for running a
FASTCGI process in multithreaded mode and that wouldn't be safe
either.

I have pointed out the Apache inconsistency before. At the same time,
there seems to be various people who have no problem running Django on
winnt and worker MPM. That FASTCGI example shows a threaded example
must also mean that is okay as well.

The most recent response I got was that any threading problems were
related to database backends and were fixed a long time ago and that
besides those issues, there weren't any specific things known of that
would be a problem in a multithreaded web server. There were also some
multithreading issues in mod_python <3.2.7 as well which may have been
making people think there were problems where there weren't.

http://groups.google.com/group/django-developers/browse_frm/thread/bfaad3e93611b2e6/d8b9f845fe31c0e1
http://groups.google.com/group/django-developers/browse_frm/thread/c72a6f0a56321ac7/381a580be1ef0751
... plus other posts I can't find right now.

Thus any issues with multithreading are perhaps more to do with how
people implement an application on top of Django. It would be nice
though to get some sort of official statement from the Django
developers on this one way or the other and document on the Django web
site what the issues are and what parts of Django if any do have
multithreading issues.

That you have made this statement that 'prefork' must be used, do you
do that as one of the developers?

> In practice this doesn't tend to pose a problem for web deployments.
> Both FCGI and Apache are designed so that they can work with non
> thread-safe applications.

Although Apache/mod_python can be setup for prefork MPM, it is not
ideal for Python web applications due to the generally large memory
requirements of the web frameworks. It is much more preferable that
worker MPM be used as it cuts down on the number of Apache child
processes. If you ever want Django to be taken up and offered as an
option by commodity web hosters then you must be able to support a
multithreaded server as they cannot afford the memory requirements of
mod_python, mod_wsgi or fastcgi solutions used in a multiprocess/
single threaded mode.

Can we please somehow settle this issue once and for all. I have tried
to get discussions going on this issue in the past but have got
minimal feedback. I thought that too a degree it had been determined
that multithreaded servers were okay, although users should though
ensure there own code is multithread safe, but now again someone is
saying that Django itself is not multithread safe. :-(

Graham


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to