Itamar Shtull-Trauring wrote:
On Wed, 2005-08-31 at 13:31 +0100, Matt Goodall wrote:
A while back, I started messing around with making a standard, blocking db-api module appear non-blocking but with a deferred API. I called it laxdb and it's in my sandbox.
I get the impression from your example:
def connected(conn): curs = conn.cursor() d = curs.execute("select * from test") d.addCallback(lambda ignore: curs.fetchall()) d.addCallback(lambda rows: pprint(rows)) # ...
that you keep dispatching to a thread, then passing it back to Twisted thread, repeatedly, unlike runInteraction which only does this once. I would guess that this will slow down complex database interactions somewhat.
Yep, I'm sure it will although I don't know how bad the effect is because I have done no timing tests. Has anyone else investigated this sort of issue before?
There is actually a comment in the module's docstring about the use of threads:
"The amount of thread context switching may hurt laxdb performance."