[Tutor] Threading...

Kent Johnson kent37 at tds.net
Sat Apr 25 13:56:24 CEST 2009

On Fri, Apr 24, 2009 at 5:26 PM, Spencer Parker <inthefridge at gmail.com> wrote:
> I have a script that I want to test MySQL sonnections with.  The way I have
> the script working is to just create connections, but I realized that it is
> going to wait for the first one to stop before starting a new connection.  I
> want to throw a ton of open connections at it to see what the connection
> limit is and how it reacts when it hits that shelf.  Would the best route
> for this be threading?  or is there another way to go about it?

Threading would be a start, though as Alan says it may not let you
test the limits.

To get started with threading you might want to use one of the thread
pool recipes in the Python cookbook.
http://code.activestate.com/recipes/576576/ (with links to many more)
http://code.activestate.com/recipes/576519/ (has the same interface as
multiprocessing.Pool so you could convert from threads to processes


More information about the Tutor mailing list