Funny behaviour of MySQLdb
Skip Montanaro
skip at pobox.com
Sat Jul 20 08:48:54 EDT 2002
>> I just tried the single-threaded way, and that works... Hmm... Nothing
>> apparently different, except that I took out the base class
>> SocketServer.ThreadingMixIn from the definition of the server class...
Alex> Rule of thumb: always ensure a single thread interacts with any
Alex> given external entity, be it a file, a database, the user, or even
Alex> a global shared variable subject to updates.
Hmmm... I'm not discounting your rule of thumb, but I use MySQL from a
multi-threaded application with no problems (at least no problems of which I
am aware). I maintain a pool of (currently five) connection objects in a
Queue. Each thread which needs to chat with the database calls .get(),
creates a cursor, chats, then returns the connection to the Queue. Guess
I'll have to go back and reread the MySQL docs and refine my stress tests.
--
Skip Montanaro
skip at pobox.com
consulting: http://manatee.mojam.com/~skip/resume.html
More information about the Python-list
mailing list