mysqldb + multi-threading
Bryan Olson
fakeaddress at nowhere.org
Fri Sep 8 16:07:26 EDT 2006
hg wrote:
> I am writing a transaction server (socket-based) under windows.
>
> I use mysqldb to log info into MySQL.
>
> It is all working and I need now to decide whether to use forks
> (CreateProcess I guess) or threads.
>
> I saw in another thread that some db engines did have issues with being
> called from threads.
Some DBMS engines, particularly SQLite, actually run within the
Python process. They might have issues with multiple threads,
but multiple processes is a nonstarter.
MySQL has its own process. It doesn't know nor care whether
your application makes connections from different processes
or different threads in the same process.
> My gut feeling is to use threads (note: each transaction is finite, so
> the process/thread die fairly quickly).
>
> Any insight ?
Go with your gut. Python threads are reasonably portable, and
work well on modern MS-Windows.
--
--Bryan
More information about the Python-list
mailing list