Tuesday, November 6, 2012

Re: Django mod-wsgi multiple instances of One Class object

On Mon, Nov 5, 2012 at 1:07 PM, drunksaint <drunksaint@gmail.com> wrote:
> This model was running perfectly in the DEV deployement. When I moved to
> PROD in apache, this broke (as in there are multiple instances of scObj
> being created, so a score update from player-1's move on player-2 is not
> reflected in a different move by player-3 on player-2) . I need to simulate
> a singleton class behaviour / global scObj behaviour, which I am not able to
> do. I am running apache in worker - mpm - multithreaded mode, so I assume
> that the problem of multiple copies of scObj being there due to
> multi-process is not there.

Django is a 'shared nothing' architecture. this is a huge advantage
when deploying, since it means you can always spawn more processes or
deploy more machines to handle extra load. Also the supervisor system
can kill tasks when misbehaving and under low loads without fear of
losing data.

Just don't store shared state locally in your process and you will
keep that feature.

If you don't want to store shared state in the database, check the
cache system. The memcache backend is really fast and stays out of
the process. But to be honest, it's quite likely that the database
will be fast enough for many cases.

--
Javier

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate