Funny behaviour of MySQLdb

Skip Montanaro skip at pobox.com
Mon Jul 22 08:20:50 EDT 2002


    >> Each time I .get() a connection from the pool, I do tend to execute
    >> multiple SQL statements.

    Alex> Yes, but, if that could be reasonably encapsulated in a callable,
    Alex> you could just pass the (callable, returnqueue) pair as the work
    Alex> request.

I guess I should have stated that "multiple SQL statements with lots of
other goo".

    >> Using a fixed numbers of threads associated with each connection is a
    >> bit more complicated, especially since I already wind up with a
    >> thread per request courtesy of SocketServer.ThreadingMixin.  Why
    >> waste it? <wink>

    Alex> Without even having seen your code I suspect your highest gain in
    Alex> scalability would come from a slightly modified ThreadingMixin
    Alex> that reuses worker-threads from a thread pool rather than churning
    Alex> out one thread per request.

Thanks, that might well be worth investigating.  I already subclass
ThreadingMixin to make each per request thread a daemon thread.  Allocating
from a fixed pool instead of creating one per request might be feasible
there.

Skip





More information about the Python-list mailing list