[Monetdb-developers] MapiClient asynchronous interface?
johann.borck at densedata.com
Sat Nov 18 17:31:52 CET 2006
Fabian Groffen wrote:
> On 18-11-2006 16:22:48 +0100, Martin Kersten wrote:
>> Hi Fabian, Johann
>> I can see the need for an asynchronous call. It works for applications
>> that that don't care about the outcome of a transaction. It also seems
>> relatively easy to implement in the Mapi server side. You have to
>> trap the async query call and handle it in the context of a new
>> server thread that discards the output (>/dev/null).
>> The 'asynquery' can immediately return to the client with an ACK
>> and terminate the session.
> The what are the effects of a long running query? I don't see any
> advantage here. You can just pool between sockets with one "main"
> thread, and try to read every once in a while by checking if there is
> data available to be read in the (TCP) buffers. This is, however, with
> many connections a deadly situation.
> Since Johann is working with a webserver, it sounds quite weird not to
> use threads in the first place to me anyway.
Well, that's a big discussion :) but using an event-driven state
machine with single- or few-threaded servers is not really an uncommon
thing, and has big advantages, e.g. the avoidance of context-switches.
Lighttpd is a prominent example, which performs extremely well compared
to, say, Apache. For really big amounts of concurrent connections the
one-thread (or even one-process)-per-connection model really is a
problem. Using epoll (or the new kevent) one can deal with thousands of
simultaneous connections without problems, especially without having to
waste lots of memory (one object/struct vs one thread) and cpu-time
(context-switches + dealing with locking issues).
When I have some time, I'll very likely give it a try in case of the
MapiClient. Changing the io-model should not affect transactions, the
asynchronous version will of course have to follow the same protocol
that the synchronous version does. I just thought maybe monetdb
supports this already, because in the TCP/IP module there are
Anyway, thanks for this great product and regards,
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> Monetdb-developers mailing list
> Monetdb-developers at lists.sourceforge.net
More information about the developers-list