I'm sure I must be missing something obvious here folks, but perhaps
someone could shed some light for me.

Could someone please point me to some material on using Django in a
load-balanced environment?

The specific problem I'm facing is model ORM objects going "stale" (the
in-memory representation is different than the database due to a change
from another machine/thread). Typically ORM layers deal with this by
supporting some form of Versioning on the records so the ORM can
freshen the cache automatically.

I find I can't keep around objects that may change and always have to
query for the latest version. This still doesn't solve the problem, but
just lessens the likelihood of it occurring. I know I'm going to get
biten by race conditions. This "stale-ness" will even happen with
concurrent sessions on the same web-server from what I can see.

For example, if I do this I seem to get in trouble:

    # Assume objects[id].data = 99

    obj1 = objects.get_object(id__exact = id)
    obj2 = objects.get_object(id__exact = id)
    obj1.data = 1
    obj1.save()
    assert (obj1.data == obj2.data) # fails

So, I seem to have to "freshen-up" any object I want to access anytime
I need to look at the member data and that's going to make the code
horrific and fragile (and remain broken).

Is there any documentation on best-practices or got-cha's for using
Django for these concurrent situations?

I've got to be missing something here, so I apologize in advance for
the silly question.

Thanks
-Zeb


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to