MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Adaptive Send Algorithm

At the time of "sending" a transaction (using NdbTransaction::execute()), the transactions are in reality not immediately transfered to the NDB Kernel. Instead, the "sent" transactions are only kept in a special send list (buffer) in the Ndb object to which they belong. The adaptive send algorithm decides when transactions should actually be transferred to the NDB kernel.

The NDB API is designed as a multi-threaded interface and so it is often desirable to transfer database operations from more than one thread at a time. The NDB API keeps track of which Ndb objects are active in transferring information to the NDB kernel and the expected amount of threads to interact with the NDB kernel. Note that a given instance of Ndb should be used in at most one thread; different threads should not use the same Ndb object.

There are four conditions leading to the transfer of database operations from Ndb object buffers to the NDB kernel:

  1. The NDB Transporter (TCP/IP, SCI or shared memory) decides that a buffer is full and sends it off. The buffer size is implementation-dependent and may change between MySQL Cluster releases. On TCP/IP the buffer size is usually around 64 KB; Since each Ndb object provides a single buffer per storage node, the notion of a "full" buffer is local to this storage node.
  2. The accumulation of statistical data on transferred information may force sending of buffers to all storage nodes.
  3. Every 10 ms, a special transmission thread checks whether or not any send activity has occurred. If not, then the thread will force transmission to all nodes. This means that 20 ms is the maximum time database operations are kept waiting before being sent off. The 10-millisecond limit is likely to become a configuration parameter in future releases of MySQL Cluster; however, for checks that are more frequent than each 10 ms, additional support from the operating system is required.
  4. For methods that are affected by the adaptive send alorithm (such as NdbTransaction::execute()), there is a force parameter that overrides its default behaviour in this regard and forces immediate transmission to all nodes. See the inidvidual NDB API class listings for more information.
Note
The conditions listed above are subject to change in future releases of MySQL Cluster.