[Twisted-Python] twisted.web and MySQLdb

Nathan Seven scosol at yahoo.com
Wed Oct 29 09:48:54 MST 2003


--- Glyph Lefkowitz <glyph at twistedmatrix.com> wrote:
> Nathan Seven wrote:
> 
> > Databases were created *specifically* for this
> > purpose.
> 
> I think that databases were specifically designed to
> store accounting 
> information, actually.

Exactly, handling and tracking dynamic data :)

> If you are writing a multiplayer game which wants to
> support lots of 
> concurrent users, you can't afford to spawn a thread
> and do a database 
> request every time a player picks something up. 
> (Python is quite slow 
> enough already, thanks.)  You can't just use a cache
> because the data 
> changes _all the time_, and you have to care about
> it from everywhere 
> that you care about your data.  Working with your
> objects directly in 
> memory is close to the only option.

I dunno- I guess I just disagree- a multiplayer game
is a perfect example of something that absolutely
requires atomic transactions.  "Buy an item->add item
to inventory->deduct $ from player" etc. That
transaction either needs to totally complete, or not
complete at all.  So now you need to build some sort
of transaction manager on top of your in-memory
objects.  Oh and then you probably want some way to
ensure that these in-memory objects dont get lost in
the case of abnormal shutdown- right?
Well- haven't you just built a couple features of any
(real) database?

> If you're writing a real-time financial data system,
> you do want to use 
> a database, but you want to very carefully control
> your access to it. 
> Certainly, you don't want to equate 'web hit' with
> 'database query', as 
> the LAMP model is wont to do.

Yes hahah- I think my overall point is just that the
seperation is key.

> Or maybe you're writing an application that has to
> operate as a 
> client-side proxy, and you don't have the leisure of
> a DBA at every 
> desk, so you can't require that an RDBMS gets set up
> with each 
> installation.  This might require some hackish
> workarounds with the 
> filesystem that you'd rather not do, but
> nevertheless, it's better than 
> having the user editing pg_hba.conf themselves.

Sure- though that specifically is the reason for
embeddable databases.

=====
--
live- http://www.thedenofsin.org/
to- AIM: IMFDUP
_born to violate._




More information about the Twisted-Python mailing list