Bug #20628 Modify NDBAPI optimized node selection to request preferred nodes
Submitted: 22 Jun 2006 14:30
Reporter: Hartmut Holzgraefe Email Updates:
Status: Verified Impact on me:
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S4 (Feature request)
Version:mysql-5.0 OS:Any (*)
Assigned to: CPU Architecture:Any

[22 Jun 2006 14:30] Hartmut Holzgraefe
Currently the NDBAPI provides the following unofficial method

  void Ndb_cluster_connection::set_optimized_node_selection(int val)

to request "optimized" node selection. By setting this flag a ndbd
server running on the same machine as the API client would always
cause this node to be picked as transaction coordinator. If there is
no ndbd node running on the same machine as the application
then the defaut round-robin node selection algorithm is used instead.

The method is meant for internal use only to implement the 
"ndb-optimized-node-selection" option of mysqld, but it could be 
of general interest for the public though. 

An even better API implementation would allow the user to pass
the IDs of one or more preferred nodes that the API should try
to connect first before falling back to the round-robin connection

Motivation: an application developer would usually have a better
understanding of the network topology an NDBAPI application is
used in than the application itself so it would be a good thing to
allow an application to pass on additional information that a node
selection can be based on.

How to repeat:
[29 Aug 2006 21:49] Pekka Nousiainen
Passing node ids could be called "rule based" selection.

I think a "cost based" selection would be better.  Add some
network metrics to config.ini, or deduce them from transporter type.

One reason is not to expose node ids to applications.  That seems
far too low-level.
[28 Sep 2016 17:43] Mauritz Sundell
Posted by developer:
In 7.5 the MySQL server option ndb_data_node_neighbour can be used to  set one preferred data node.
The option was introduced with the new read backup feature.

Some notes how and when to use ndb_data_node_neighbour can be read in