List:NDB Connectors« Previous MessageNext Message »
From:Mika Raento Date:March 19 2007 10:14am
Subject:Integrating NDB async transactions with other event loops
View as plain text  
Hiya'll

I'm looking to use the NDB connectors from Python and Perl based 
async-io frameworks (specifically, Twisted and Danga::Socket) and have 
been digging a bit into how this would be done as efficiently as possible.

First of all: has anybody already done something that integrates NDB 
into an existing event loop? I'd love to hear your experiences. Second 
question: is there any real documentation on how (or whether) the NDB 
API uses threads internally?

My current understanding is pretty much that:
1. I don't seem to find an easy way to access the file descriptors that 
are used by the transport layer in NDB so that I could add them to my 
select/epoll loop (which would be the best option - I'd just have to 
forego the shared memory transport, since that's not file-descriptor based).
2. I could call Ndb::pollNdb periodically. I would have to balance 
carefully the frequency against the main event loop's timeouts and 
frequency, but it's a realistic option.
3. However, it seems from reading the code that calling pollNdb with a 
timeout of 0 won't actually make it try to receive anything, it just 
looks into its completed transactions and sees whether there are any. 
Calling it with a a timeout > 0 seems to make it do a select() with a 
timeout of one second :-(. I would say that a few milliseconds would be 
the most I'd like to wait for input when calling it.

I'm going to be looking into this and posting my results to the list, 
but I'd be really happy if anybody has some insights.

	Mika


Thread
Integrating NDB async transactions with other event loopsMika Raento19 Mar
  • configure.in missing AC_CANONICAL_HOST, won't work on OS-XMika Raento19 Mar
    • Re: configure.in missing AC_CANONICAL_HOST, won't work on OS-XMonty Taylor20 Mar
  • Re: Integrating NDB async transactions with other event loopsMonty Taylor22 Mar
    • Re: Integrating NDB async transactions with other event loopsMika Raento23 Mar