How to define quality of service in the plugins config file.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@321271 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Ulf Wendel 2011-12-20 11:10:47 +00:00
parent 97bc4a3763
commit 14ed86dd0d
2 changed files with 72 additions and 11 deletions

View file

@ -814,7 +814,7 @@ version = 5.6.2-m5-log
load balancing policies. The 'round robin' load balancing can be configured
through the <literal>roundrobin</literal> filter. Setting a 'user defined
callback' for server selection is possible with the <literal>user</literal>
filter. The <literal>qos</literal> (quality-of-service) filter finds cluster
filter. The <literal>quality_of_service</literal> filter finds cluster
nodes capable of delivering a certain service, for example, read-your-writes or,
not lagging more seconds behind the master than allowed.
</para>
@ -880,7 +880,7 @@ version = 5.6.2-m5-log
</para>
<para>
A second type of filter exists: multi filter. A multi filter emits zero, one or multiple
servers after processing. The <literal>qos</literal> (quality-of-service) filter
servers after processing. The <literal>quality_of_service</literal> filter
is an example. If the service quality requested sets an upper limit for the slave
lag and more than one slave is lagging behind less than the allowed number of seconds,
the filter returns more than one cluster node. A multi filter must be followed by other
@ -888,7 +888,7 @@ version = 5.6.2-m5-log
is found.
</para>
<para>
A filter sequence with the <literal>qos</literal> (quality-of-service)
A filter sequence with the <literal>quality_of_service</literal>
multi filter followed by a load balancing filter.
<itemizedlist>
<listitem>
@ -907,7 +907,7 @@ version = 5.6.2-m5-log
</listitem>
<listitem>
<simpara>
Filter: <literal>qos</literal>, rule set: read-your-writes
Filter: <literal>quality_of_service</literal>, rule set: session_consistency (read-your-writes)
Output: <literal>master_0</literal>
</simpara>
</listitem>

View file

@ -1119,19 +1119,19 @@ User has connected to 'myapp'...
</varlistentry>
<varlistentry xml:id="ini.mysqlnd-ms-plugin-config-v2.filter_qos">
<term>
Filter: <parameter>qos</parameter>
Filter: <parameter>quality_of_service</parameter>
<type>object</type>
</term>
<listitem>
<para>
The quality-of-service (qos) filter identifies cluster nodes
The <literal>quality_of_service</literal> identifies cluster nodes
capable of delivering a certain quality of service. It is a multi filter
which returns zero, one or multiple of its input servers. Thus, it
must be followed by other filters to reduce the number of candidates
down to one for statement execution.
</para>
<para>
The <literal>qos</literal> filter has been introduced in 1.2.0-alpha.
The <literal>quality_of_service</literal> filter has been introduced in 1.2.0-alpha.
In the 1.2 series the filters focus is on the consistency aspect of
service quality. Different types of clusters offer different
default data consistencies. For example, an asynchronous MySQL
@ -1140,15 +1140,25 @@ User has connected to 'myapp'...
it may serve stale database because its lagging behind or it may serve
current information. Often, this is acceptable. In some cases
higher consistency levels are needed for the application to work correct.
In those cases, the <literal>qos</literal> can filter out cluster nodes
In those cases, the <literal>quality_of_service</literal> can filter out cluster nodes
which cannot deliver the necessary quality of service.
</para>
<para>
The <literal>qos</literal> filter can be replaced
The <literal>quality_of_service</literal> filter can be replaced or created
at runtime. A successful call to
<link linkend="function.mysqlnd-ms-set-qos"><function>mysqlnd_ms_set_qos</function></link>
removes all existing <literal>qos</literal> filter entries from the
filter list and installs a new one at the very beginning.
filter list and installs a new one at the very beginning. All settings
that can be made through
<link linkend="function.mysqlnd-ms-set-qos"><function>mysqlnd_ms_set_qos</function></link>
can also be in the plugins configuration file. However, use of the function
is by far the most common use case. Instead of setting session consistency and
strong consistency service levels in the plugins configuration file it is
recommended to define only masters and no slaves. Both service levels will
force the use of masters only. Using an empty slave list shortens the
configuration file, thus improving readability. The only service level for which
there is a case of defining in the plugins configuration file is the combination
of eventual consistency and maximum slave lag.
</para>
<informaltable>
<tgroup cols="3">
@ -1172,6 +1182,57 @@ User has connected to 'myapp'...
Request eventual consistency. Allows the use of all
master and slave servers. Data returned may or may not be current.
</para>
<para>
Eventual consistency accepts an optional <literal>age</literal>
parameter. If <literal>age</literal> is given the plugin considers
only slaves for reading for which MySQL replication reports
a slave lag less or equal to <literal>age</literal>.
The repliation lag is measure using <literal>SHOW SLAVE STATUS</literal>.
If the plugin fails to fetch the replication lag, the slave tested
is skipped. Implementation details and tipps are given in the
<link linkend="mysqlnd-ms.qos_consistency">quality of service concepts section</link>.
</para>
<para>
Please note, if a filter chain
generates an empty slave list and the PHP configuration directive
<literal>mysqlnd_ms.multi_master=0</literal> is used, the plugin may
emit a warning.
</para>
<para>
<example>
<title>Global limit on slave lag</title>
<programlisting role="ini">
<![CDATA[
{
"myapp": {
"master": {
"master_0": {
"host": "localhost"
}
},
"slave": {
"slave_0": {
"host": "192.168.2.27",
"port": "3306"
},
"slave_1": {
"host": "192.168.78.136",
"port": "3306"
}
},
"filters": {
"quality_of_service": {
"eventual_consistency": {
"age":123
}
}
}
}
}
]]>
</programlisting>
</example>
</para>
</entry>
<entry>Since 1.2.0.</entry>
</row>
@ -1376,7 +1437,7 @@ User has connected to 'myapp'...
</example>
</para>
<para>
Please, note the <literal>qos</literal> (quality of service) filter introduced
Please, note the <literal>quality_of_service</literal> filter introduced
in version 1.2.0-alpha. It gives finer control, for example, for achieving read-your-writes
and, it offers additional functionality introducing
<link linkend="mysqlnd-ms.qos_consistency">service levels</link>.