Oracle 5.0 Reference Manual page 2651

Table of Contents

Advertisement

Mysqlnd replication and load balancing plugin (mysqlnd_ms)
bool
master_on_write
string
trx_stickiness
MySQL replication master server and two MySQL replication slaves,
the plugin will open three connections upon the first call to a connect
function although the application might use the master connection
only.
Lazy connections bare a risk if you make heavy use of actions which
change the state of a connection. The plugin does not dispatch
all state changing actions to all connections from the connection
pool. The few dispatched actions are applied to already opened
connections only. Lazy connections opened in the future are not
affected. If, for example, the connection character set is changed
using a PHP MySQL API call, the plugin will change the character
set of all currently opened connection. It will not remember the
character set change to apply it on lazy connections opened in
the future. As a result the internal connection pool would hold
connections using different character sets. This is not desired.
Remember that character sets are taken into account for escaping.
If set, the plugin will use the master server only after the first
statement has been executed on the master. Applications can
still send statements to the slaves using SQL hints to overrule the
automatic decision.
The setting may help with replication lag. If an application runs an
the plugin will, by default, use the master to execute all
INSERT
following statements, including
avoid problems with reads from slaves which have not replicated the
yet.
INSERT
Transaction stickiness policy. Supported policies:
(default), master.
Experimental feature.
The setting requires 5.4.0 or newer. If used with PHP older
than 5.4.0, the plugin will emit a warning like
trx_stickiness strategy is not supported before
PHP
5.3.99.
If no transaction stickiness policy is set or, if setting
trx_stickiness=disabled, the plugin is not transaction
aware. Thus, the plugin may load balance connections and switch
connections in the middle of a transaction. The plugin is not
transaction safe. SQL hints must be used avoid connection switches
during a transaction.
As of PHP 5.4.0 the mysqlnd library allows the plugin
to monitor the
autocommit
the libraries
trx_autocommit()
trx_stickiness=master
a PHP MySQL extension invoking the
function call trx_autocommit(), the plugin is made aware of the
begin of a transaction. Then, the plugin stops load balancing and
directs all statements to the master server until
enabled. Thus, no SQL hints are required.
An example of a PHP MySQL API function calling the
library internal function call
mysqlnd
mysqli_autocommit.
2631
statements. This helps to
SELECT
disabled
(mysqlnd_ms)
mode set by calls to
function. If setting
and
gets disabled by
autocommit
library internal
mysqlnd
autocommit
trx_autocommit()
is
is

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents