[prev in list] [next in list] [prev in thread] [next in thread]
List: php-doc-cvs
Subject: [DOC-CVS] =?utf-8?q?svn:_/phpdoc/en/trunk/reference/mysqlnd=5Fms/_concepts.xml_setup.xml?=
From: Ulf_Wendel <uw () php ! net>
Date: 2012-06-28 13:58:33
Message-ID: svn-uw-1340891913-326367-1901405493 () svn ! php ! net
[Download RAW message or body]
uw Thu, 28 Jun 2012 13:58:33 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=326367
Log:
Weigthed load balancing with 1.4.
Changed paths:
U phpdoc/en/trunk/reference/mysqlnd_ms/concepts.xml
U phpdoc/en/trunk/reference/mysqlnd_ms/setup.xml
["svn-diffs-326367.txt" (text/x-diff)]
Modified: phpdoc/en/trunk/reference/mysqlnd_ms/concepts.xml
===================================================================
--- phpdoc/en/trunk/reference/mysqlnd_ms/concepts.xml 2012-06-28 12:18:05 UTC (rev \
326366)
+++ phpdoc/en/trunk/reference/mysqlnd_ms/concepts.xml 2012-06-28 13:58:33 UTC (rev \
326367) @@ -664,6 +664,9 @@
the statement.
</para>
<para>
+ <emphasis role="bold">Default: manual failover</emphasis>
+ </para>
+ <para>
It is up to
the application to handle the error and, if required, re-issue the query to
trigger the selection of another slave server for statement execution.
@@ -685,6 +688,9 @@
failover on a connection that has been connected to MySQL already in the past.
</para>
<para>
+ <emphasis role="bold">Automatic failover</emphasis>
+ </para>
+ <para>
The failover policy is configured in the plugins configuration file, by
using the <link linkend="ini.mysqlnd-ms-plugin-config-v2.failover">failover</link>
configuration directive.
@@ -705,6 +711,37 @@
<link linkend="mysqlnd-ms.errorhandling">error handling</link> section.
</para>
<para>
+ <emphasis role="bold">Standby servers</emphasis>
+ </para>
+ <para>
+ Using <link linkend="ini.mysqlnd-ms-plugin-config-v2.filter-random">weighted load \
balancing</link>, + introduced in PECL/mysqlnd 1.4.0, it is possible
+ to configure standby servers that are sparsely used during normal operations.
+ A standby server that is primarily used as a worst-case standby failover target
+ can be assigned a very low weight/priority in relation to all other
+ servers. As long as all servers are up and running the majority of the workload
+ is assigned to the servers which have hight weight values. Few requests
+ will be directed to the standby system which has a very low weight value.
+ </para>
+ <para>
+ Upon failure of the servers with a high priority, you can still failover to
+ the standby, which has been given a low load balancing priority by assigning a \
low + weight to it. Failover can be some manually or automatically. If done
+ automatically, you may want to combine it with the
+ <link linkend="ini.mysqlnd-ms-plugin-config-v2.failover"><literal>remember_failed</literal></link>
+ option.
+ </para>
+ <para>
+ At this point, it is not possible to instruct the load balancer to direct no
+ requests at all to a standby. This may not be much of a limitation given that
+ the highest weight you can assign to a server is 65535. Given two slaves,
+ of which one shall act as a standby and has been assigned a weight of 1,
+ the standby will have to handle far less than one percent of the overall \
workload. + </para>
+ <para>
+ <emphasis role="bold">Failover and primary copy</emphasis>
+ </para>
+ <para>
Please note, if using a primary copy cluster, such as MySQL Replication, it is
difficult to do connection failover in case of a master failure.
At any time there is only one master in the cluster for a given dataset.
Modified: phpdoc/en/trunk/reference/mysqlnd_ms/setup.xml
===================================================================
--- phpdoc/en/trunk/reference/mysqlnd_ms/setup.xml 2012-06-28 12:18:05 UTC (rev \
326366)
+++ phpdoc/en/trunk/reference/mysqlnd_ms/setup.xml 2012-06-28 13:58:33 UTC (rev \
326367) @@ -845,16 +845,146 @@
</example>
</para>
<para>
- Unknown arguments are ignored. No warning or error is given.
+ Both the <literal>random</literal> and <literal>roundrobin</literal>
+ filters support setting a priority, a weight for a server, since
+ PECL/mysqlnd_ms 1.4.0. If the <literal>weight</literal> argument is
+ passed to the filter, it must assign a weight for all servers. Servers
+ must be given an alias name in the <literal>slave</literal> respectively
+ <literal>master</literal> server lists. The alias must be used
+ to reference servers for assigning a priority with <literal>weight</literal>.
</para>
-
<para>
- Expects one or more servers as input. Outputs one server.
+ <example>
+ <title>Referencing error</title>
+ <screen>
+<![CDATA[
+[E_RECOVERABLE_ERROR] mysqli_real_connect(): (mysqlnd_ms) Unknown server 'slave3' in \
'random' filter configuration. Stopping in %s on line %d +]]>
+ </screen>
+ </example>
+ </para>
+ <para>
+ Using a wrong alias name with <literal>weight</literal> may result in
+ an error similar to the shown above.
+ </para>
+ <para>
+ If <literal>weight</literal> is omitted, the default weight of
+ all servers is one.
+ </para>
+ <para>
+ <example>
+ <title>Assigning a <literal>weight</literal> for load balancing</title>
+ <programlisting role="ini">
+<![CDATA[
+{
+ "myapp": {
+ "master": {
+ "master1":{
+ "host":"localhost",
+ "socket":"\/var\/run\/mysql\/mysql.sock"
+ }
+ },
+ "slave": {
+ "slave1": {
+ "host":"192.168.2.28",
+ "port":3306
+ },
+ "slave2": {
+ "host":"192.168.2.29",
+ "port":3306
+ },
+ "slave3": {
+ "host":"192.0.43.10",
+ "port":3306
+ },
+ },
+ "filters": {
+ "random": {
+ "weights": {
+ "slave1":8,
+ "slave2":4,
+ "slave3":1,
+ "master1":1
+ }
+ }
+ }
+ }
+}
+]]>
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ At the average a server assigned a weight of two will be selected twice
+ as often as a server assigned a weight of one. Different weights can be
+ assigned to reflect differently sized machines, to prefer co-located slaves
+ which have a low network latency or, to configure a standby failover server.
+ In the latter case, you may want to assign the standby server a very low
+ weight in relation to the other servers. For example, given the
+ configuration above <literal>slave3</literal> will get only some eight
+ percent of the requests in the average. As long as <literal>slave1</literal>
+ and <literal>slave2</literal> are running, it will be used sparsely,
+ similar to a standby failover server. Upon failure of \
<literal>slave1</literal> + and <literal>slave2</literal>, the usage of \
<literal>slave3</literal> + increases. Please, check the notes on failover \
before using + <literal>weight</literal> this way.
+ </para>
+ <para>
+ Valid weight values range from 1 to 65535.
+ </para>
+ <para>
+ Unknown arguments are ignored by the filter. No warning or error is given.
+ </para>
+ <para>
+ The filter expects one or more servers as input. Outputs one server.
A filter sequence such as
<literal>random</literal>, <literal>roundrobin</literal> may
cause a warning and an error message to be set on the connection
handle when executing a statement.
</para>
+ <para>
+ List of filter arguments.
+ </para>
+ <informaltable>
+ <tgroup cols="3">
+ <colspec colwidth="1*"/>
+ <colspec colwidth="7*"/>
+ <colspec colwidth="2*"/>
+ <thead>
+ <row>
+ <entry>Keyword</entry>
+ <entry>Description</entry>
+ <entry>Version</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <literal>sticky</literal>
+ </entry>
+ <entry>
+ <para>
+ Enables or disabled random once load
+ balancing policy. See above.
+ </para>
+ </entry>
+ <entry>Since 1.2.0.</entry>
+ </row>
+ <row>
+ <entry>
+ <literal>weight</literal>
+ </entry>
+ <entry>
+ <para>
+ Assigns a load balancing weight/priority to
+ a server. Please, see above for a description.
+ </para>
+ </entry>
+ <entry>Since 1.4.0.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
</listitem>
</varlistentry>
<varlistentry xml:id="ini.mysqlnd-ms-plugin-config-v2.filter-roundrobin">
@@ -904,6 +1034,38 @@
cause a warning and an error message to be set on the connection
handle when executing a statement.
</para>
+ <para>
+ List of filter arguments.
+ </para>
+ <informaltable>
+ <tgroup cols="3">
+ <colspec colwidth="1*"/>
+ <colspec colwidth="7*"/>
+ <colspec colwidth="2*"/>
+ <thead>
+ <row>
+ <entry>Keyword</entry>
+ <entry>Description</entry>
+ <entry>Version</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <literal>weight</literal>
+ </entry>
+ <entry>
+ <para>
+ Assigns a load balancing weight/priority to
+ a server. Please, find a description
+ <link linkend="ini.mysqlnd-ms-plugin-config-v2.filter-random">above</link>.
+ </para>
+ </entry>
+ <entry>Since 1.4.0.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
</listitem>
</varlistentry>
<varlistentry xml:id="ini.mysqlnd-ms-plugin-config-v2.filter-user">
--
PHP Documentation Commits Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic