[Zope] Re: MySQL thread connection question

Andy Dustman farcepest at gmail.com
Mon Aug 16 14:42:35 EDT 2004


A long time ago, I made a very simple Pool class (based on
Queue.Queue) which was primary for things like connection pooling. I
never found the need to incorporate it into ZMySQLDA, but if you want
to try it out, it's here

http://dustman.net/andy/python/Pool

It should even work on some antique versions of Python (1.5.2).

Another thing you can try is the ping() method on the database
connection. This tests to see if the connection is still open, and if
not, it re-opens it.

You can also kill threads on the server side.  SHOW PROCESSLIST will
show all active connections. Anything with Command='Sleep' and
Time>some number of seconds you can kill with KILL id. For example,
you could have a job that runs periodically and kills any connection
by a certain user that has been sleeping longer than your timeout
value. If you do this, you will definitely want to have ping()
incorporated into ZMySQLDA, most likely in the begin() method; it
should probably be in there anyway.
-- 
Computer interfaces should never be made of meat.


More information about the Zope mailing list