Non-blocking Connector/C driver ?
Posted by: Darryl Miles
Date: March 26, 2010 09:10AM

I'm looking for a non-blocking C language connector, what I mean by this is that it would be possible to use the driver in various modes:
* Fully non-blocking meaning the application takes charge of the sleep/wake mechanic and no MySQL API call would block.
* Partially non-blocking meaning the API would have control per API call (or via a fallback default global) over limited-sleep functionality, meaning a upper limit of wall clock time could be given to block, then control would return back to the application (with a suitable soft-error return indication).
* Blocking mode but with interruption ability, this is just like the limited-sleep functionality (in case above) except the sleep timeout is infinite. The underlying socket is in non-blocking mode (as per all the other cases above) and MySQL client library is managing the sleep/wake up internally (as per the case above). This allows for MySQL client library to interrupt itself.
* Blocking mode, socket is in blocking mode just as it is now. The requirement here is to allow a smooth transition between blocking mode and non-blocking mode on a whim by the application if it so chooses. This is a per-connection application specified configuration demand. Interruption support may not be possible this case depending on the platforms abilities.


The area of attention that are important:
* The entire connection procedure (DNS lookup, connecting across the network, authenticating, sending initial options, selecting database)
* During the execution of statements on the MySQL server.
* During the time the open connection spends idle (i.e. ability for application to monitor for network disconnections, inbound async server data response)
* During connection shutdown (with the ability to force an abrupt unclean shutdown immediately from the client side).


The API would/could provide in common use cases 1 additional argument (and a slight symbol change to maybe prefix/suffix the existing commonly used name) that would contain a stricture used to describe the blocking behavior allowed for that call.

One nice to have feature would be that where the MySQL client library is providing the limited-sleep mechanism that a thread-safe API call be available to force a wakeup and early return of the single-thread that was sleeping.


Also when I talk about non-blocking, I generally mean blocking waiting for I/O in the general sense, or blocking waiting for an external party to do something at some point in time that is beyond our control. For all intents and purpose control of the execution at the application should be returned back to the caller (of the API) at the earliest opportunity and all I/O work is carried out asynchronously.

Matters which are local computational issues and making system calls what do not block, stuff like this are fine to run synchronously. I'm not looking to create some kind of sub-thread to do all MySQL API work; this is actually the scenario I'm trying to avoid.



My main interest here is not so much the handling of long-running statements at the SQL server since usually this workload requires synchronous operation as something is waiting for the statement results before being able to proceed execution in the client application. It is the management of a thread-pooler which itself doesn't require a thread per idle connection to perform any kind of management function (connection, ping test, ahead-of-time connection, connection pool pruning, disconnection)


I have seen some notes with the MySQL provided driver indicating that parts of the above are possible.

RFC

Darryl



Edited 2 time(s). Last edit at 03/26/2010 09:15AM by Darryl Miles.

Options: ReplyQuote


Subject
Views
Written By
Posted
Non-blocking Connector/C driver ?
4798
March 26, 2010 09:10AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.