Google Groups Home
Help | Sign in
Message from discussion Django 100% threadsafe with DB?
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Benjamin Slavin  
View profile
 More options Sep 25 2007, 8:27 pm
From: "Benjamin Slavin" <benjamin.sla...@gmail.com>
Date: Tue, 25 Sep 2007 20:27:52 -0400
Local: Tues, Sep 25 2007 8:27 pm
Subject: Re: Django 100% threadsafe with DB?
On 9/25/07, Mike Scott <mic...@gmail.com> 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).

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

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.

Where you may run into some difficulty is if you want to make a
multi-threaded backend application.

If you'd like to discuss this issue further, please bring it up on django-users.

> I think more research should be done into this sort of operation

Database locking has been discussed previously on this list and in a
number of related tickets in Trac.  This is currently the recommended
approach for ensuring data integrity in a Django app.  It is, however,
true that there are still some race conditions that require special
attention (get_or_create is one of them).

I agree that there should probably be more information about how to
handle massively parallel web applications, but that's not a
Django-specific concern.  Many web developers don't understand how to
handle these issues, and I haven't found a good resource to point
people toward (suggestions welcome).

I hope this helps to clarify things a bit.

 - Ben


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google